You could use a larger electrolytic cap for the power supply, and some NVM to save relevant states.
The larger cap just keeps up the supply voltage some milliseconds, long enough to save the state values.
Would add some BOM costs, but allow for arbitrary long power outages.
I used this method some while ago for lighting equipment, wher this was a requirement of the standard the devices satisfied.