Best option is to do this directly on the device. It is possible ssh is getting updated and the connection will drop. I am unsure if there is a machanism in ubuntu to prevent this…
There’s no pressing reason to upgrade, so no reason to invite the tiny risk of trouble. Ubuntu 16.04 is not going to make anything materially better for you in a headless application like this.
As far as headless/ssh goes, ubuntu opens up a second sshd on an alternate port that is meant to survive even in the rare case that something goes wrong with the update and you lose the “main” sshd. I’ve never needed to use this (and I’ve updated dozens of machines without a head over the years, often hundreds of miles away in a data center someplace).