I can see how Imcbmai's and other's suggestions could be valid and workable IF the printer itself didn't move when the motors were disabled. I have a 500VA APC on my Ender 3, but it's just barely big enough not to be overloaded. The smart plug I have on it has reported just over 420VA load when both hotend and bed are heating. The entire draw for my Pi and printer idle is about 13VA and 25VA after homing (7VA extra w/ LEDs). You'd probably not want to disable the steppers until the UPS was issued a low battery warning anyway. By that time you're possibly in a long power cut or your UPS is too small; not good to be your print in that case.
Most non-flexible build surfaces do release when they cool so that would have to be addressed in sizing the UPS to keep the bed hot if you wanted to resume. Mine sticks like it's glued when cold so no issue there.
That said, I have no idea how to write plugins or interface one w/ a UPS daemon. I think the Octo REST API could be used for all the printer controls.