I guess my solution that would be a UPS that detects the power outage, provides 1-2 minutes of power while a connected controller (a raspberry pi or similar) forces the inverter into off-grid mode. When power is restored, a connected current clamp/CT sensor can tell the raspberry pi to cancel off-grid mode.
A bit complex but I suppose the other option is relay isolators / mains contractors which are a bit too “high voltage” for me