I'd back up the phone to an SD card and/or send the backup offsite over the network.
After that, I could nuke whatever I wanted -- or factory reset it, switch to a different OS (we often called them "ROMs" back then), play with that for a bit, switch back and forth, or whatever.
When the time was right, I'd use TiBackup to restore the backup. It didn't even have to be the same phone. Apps and data were restored to where they had been. Home screens looked the same. Settings and preferences went back to how they were. The same web stuff remained in browser cache, alongside the same cookies.
There were occasional outliers that didn't come back perfectly, of course, but broadly speaking: It worked very well. Those outliers were few and easy to deal with.
This required root access. But for a time (years), that was easy.
(I will never accept any defense of any proclamations that we must be restricted from doing whatever the fuck we want with the hardware that we own. If I can do things with a desktop PC, then I should also be able to do those same things with a pocket computer.)