What stops AC from my UPS leaking into the grid?
Figure 1. Source: etchnog.com.
A UPS converts mains AC to DC to charge the battery. The battery, when required powers the inverter and feeds the load.

I wonder what stops this current from going to the rest of the household circuit ...

The rectifier diodes are electrical one-way valves. They block current from flowing in the reverse direction. The LED -&gt; Diode -&gt; non-return valve of my article What is an LED may be of interest.