Historically, some people thought it was a cool idea to run phones as servers with a built in UPS (I looked into it myself) but the problem is phone batteries have a nasty habit of exploding
Habit? It's been known to happen on rare occasion, but a habit?
They tend to turn into those inflated pillows (and perhaps even rupture?) when connected to power all the time. You could disassemble the phone, remove the battery, and reassemble and use it without it (if it boots and is stable).
A simple solution might be to put the charger on a timer.