Speak to a Professional in Electrical Code, there will be good guidance about the legality and if it is covered in an insurance claim, is needed to be made on the home insurance policy.
A step-around option might be discovered that meets code if the proposed method is a breach.
Alternatively, have a look at a standalone power supply from a battery bank and an inverter.

