If the relay is turned on at the point in time when you disconnect the 12 V, the relay current will discharge the 12 V capacitors (C1 and C?, the other 10uF one) very quickly.
However, the problem may happen when you reconnect rather than when you disconnect. You could try disconnecting at the 12 V, then disconnect the mains input, then wait for the 12 V power supply to discharge, reconnect the 12 V and then reconnect the mains.
I suggest that you use and oscilloscope to record the 12 V, the 5 V and the 3.3 V supplies during turn-on and during turn off.
You could put a diode in series with the 12 V supply to the regulators so that the coil will not discharge the capacitors quickly. You could increase the capacitor size so that the voltage falls more slowly. You could also run the 3.3 V regulator from the 5 V supply, but that would need a different type of regulator as the LM317 has a high drop-out voltage.
You could monitor the 12 V supply using the microcontroller and suspend all I2C operations below 10 or 11 V.
You definitely should change the pull ups onto the 3.3 V supply.