So I bought a replacement phone (I doubt the model matters but it's a Moto Z Play) and now it's catching up with upgrades and there are many updates and every one of them is taking like 15 or more minutes because at first it installed all the apps from the old phone... how could I tell it to install all upgrades first and only then optimize them?
See the accepted answer by elderathis for a good explanation of what optimising apps does What kind of app optimizations do newer Android versions do at the first reboot? - re-creates Dalvik / ART (lollipop upwards) cache for each app. This is done with each OTA
It's only when the OTA is completed, the device looks for availability of fresh updates and proceeds to download and update next OTA. This is because the version on the device is checked for integrity and that it's not tampered with (as in the case of rooted devices or modifications to
/systempartition ) to be start the OTA process.
Your case of updating multiple OTAs in one shot I suppose is not the usual use -case so it does ìt incrementally instead of applying all updates and then optimising, though in theory it could work that way
Edit: Some of these updates could be incremental updates, which demand the previous build
Distribute an incremental package only to devices running exactly the same previous build used as the incremental package's starting point.