Aqara D1 wired switch: Turn off the decoupled mode on losing connection

I configured Aqara D1 wall switch (QBKG24LM) to operate in decoupled mode using zigbee2mqtt integration, but I wonder if it is possible for it to fall back to controlling the relay directly when the connection to HA is lost for some reason (USB stick is unavailable, HA server is down, etc.).
I know that you can publish a payload like this {"operation_mode_left": "control_left_relay"} to the topic zigbee2mqtt/<switch name>/set to set the mode to control the relay, but I am not sure if there are any triggers that I can use for my case.

The only reason I want to use the decoupled mode is to be able to configure one of the buttons to turn off all the lights (technically, all the other Aqara switches) in the house on double press. It is still possible to create an automation that is triggered on double press when the switch controls the relay directly but every press of that double press also toggles the lights it is connected to before triggering the automation and it is a bit annoying.

Decoupled mode is great but I am afraid of the case of the switch losing connection with HA.