I'd suggest not powering the pi from the ACC feed.
Instead power it directly from the battery by use a couple of relays to control the switching.
The circuit below is theoritical but did simulate OK. Ignore component values and part numbers they're probably sub optimal. And the relays could probably use some back EMF supression diodes. The gpio input should proably have some current limiting and, maybe, an external pullup.
I never did get around to building this
Power into the first relay is routed out its NO contact and into a second relay. The NC output of the second relay feeds the voltage conversion/PSU for the Pi, back into the first relay's coil to keep it "on", and into one side of the coil of the second relay.
When the ACC feed is switched on, the first relay switches sending power onwards.
Once the Pi detects, via the opto coupler, that the ACC feed has switched off the Pi can perform a safe shutdown and the gpio-poweroff device tree overlay is used to switch the second relay via the transistor cutting power.
Switch S1 is there to provide a manual kill switch in the event of a software crash preventing the Pi from shuting down.
This space unintentionally left blank.