I have noticed, when running a USB hub (for which the power is cut at the same moment) it sinks power that does not allow the HAT to switch fast enough, or cleanly enough, to battery power to keep the pi powered; it immediately shuts down. In a limited number of cases in tests without the USB (and attached devices like Wifi adapter and phone) hub connected the system was able to enter battery mode quickly enough and the system did not lose power.
I mention this to elicit additional testing if this method does not work perfectly.
Because the hub can also be DC powered I plan to build a “no DC over USB adapter” from USB->terminal block connectors. I am hoping this will sufficiently isolate the USB hub and prevent the power spike that it causes to the system at the critical moment.