Phones that can have their battery removed tend to work fine plugged in with their battery removed, so that's an option. Also a good reason to make sure you don't buy a device that you can't open. I made that mistake with my current phone, and I definitely won't be making that mistake again if I get another smart phone.
You can use a smart plug that turns on when the battery drops below 20%. I’m going to use this kind of automation for a tablet with HomeAssistant in kiosk mode.
I guess you increase the cost of your setup by adding an intermittent power switch / timer that turns charger power on and off. With MQTT, the server itself could drive the switch, and turn the charger on when the battery is low enough, turn it off when full enough.
If you don't mind disassembling and finding connectors or soldering, you can connect a power supply with the same voltage as the battery to the battery connector on the main board.
Interesting, I’ll need to see how this affects my use case. I assumed that devices plugged into power operate on power while charging the battery, at least my laptop does.