Is there a way to optimize the process of uninstalling and installing SSMS? in terms of patching sql server 2016 to the latest cumulative patches, I found out that stopping the services helps avoiding lots of inconveniences, specially if there is log shipping and replication involved:

However,
when upgrading to the newest SSMS, stopping the services does not seem to make the uninstall of the old version go quicker, it is indeed a very slow process.

same slow is the installation.

even having the relevant services stopped for this operation:

Plus a reboot at the end of the process.
Is there anything that can be done, in order to automate or optimise the process of installing the new SSMS (currently 18.5.1)?
All of the relatively recent versions of SSMS install side-by-side with each other, so I wouldn't bother removing them honestly. They'll upgrade the current version if it is on the same major release.
The newer versions are being released faster and sometimes can be a bit buggy, so having an older version to fall back on can also be helpful if you encounter a bug.
As far as making it faster, you could try using a package manager like winget (in preview, but by Microsoft) or chocolatey or any other generic automation software (Ansible, etc.)
There is also the command line option of SSMS itself, as Kin mentioned. And I will also echo the warning to not be doing this regularly (or at all) on the actual SQL Server machine.