What happens if the load (connected to the output of the circuit) disconnects suddenly from Arduino/ESP32?
It depends on what the load connected to the battery is. If there's a high load with a lot of inductance (common for motor applications), there can be a large voltage spike caused by the sudden decrease in current, which can damage your electronics if they aren't properly protected. The best way to prevent this is to have some sort of soft stop (ex: telling the motor controller/other load to reduce current to 0 before you disconnect the load).

For switching capacitive loads using electromechanical switches such as relays or contactors, you will need to make sure that there isn't excessive inrush current to prevent damage to the switch. If the inrush current is high enough, it can cause the contacts to weld closed and you won't be able to open the relay. Even if this doesn't happen, the arcing will increase the contact resistance inside the relay and cause additional heating, which lowers the maximum continuous current rating of the relay.

Inrush currents can be avoided by using a pre-charge circuit to limit the current while the capacitors are charged up initially. A good rule of thumb is to wait until the capacitor voltage has reached at least 90% of the input before closing the main relay (don't open the precharge circuit until ~100ms after you send the command for the main relay to close to ensure the switch has time to actuate). The simplest way this can be done is with another switch in parallel with your main one that has a resistor in series with it:



(Image from Panasonic website. Source: https://www3.panasonic.biz/ac/e/control/relay/photomos/app_circuits/index.jsp)

This all being said, if you aren't switching that high of a load, you may not have to worry about these issues. If it's feasible, you can manually switch the relay closed without your electronics connected while measuring the voltage across a shunt resistor in series with the load using an oscilloscope set up in single trigger mode to capture max current draw. Also scope the voltage across the load when the relay switches open under load to see if there's an inductive spike.