Add diode to stop 12V feeding back into the Pi battery if both battery and 12V feeds get switched on at the same time.