That is why I run my "vintage" MacBook pro without a battery (first unibody, with swappable battery), always plugged in. It works for me as it stays stationary at home. If I need to unplug for any reason, I close the lid and macOS saves everything, then unplug, replug later, and nothing is lost.
Wow, I love that. Still, there must be some small coin-sized battery on the motherboard that's saving state, which will have to be replaced at some point?
Problematic if you have a magsafe connector in combination with kids or pets running around though. Or just if you trip over the cable yourself. In my unfortunate experience :P