Off-the-shelf Device for Logically Controlling 12V Loads
I'd like to suggest board mounted SSRs (solid state relays) as an easy to implement, albeit slightly more expensive ($2-3), solution to your problem.  These devices could almost be thought of as a 'system-on-chip' for power switching as they integrate many discrete components which might be used into one convenient package.

To use one of these devices, you need to drive a (usually infrared) LED on the input side at a forward voltage of ~1-1.3V and ~2-5mA.  This can be done directly from an Arduino GPIO pin (an maybe a Raspberry Pi pin, check the specifications for pin current capacity) using only an additional current limiting resistor.  For example, to drive the input at 2mA from a 5V GPIO output configured pin: 5V - 1.3V / 0.002A = 1,750Ohm ~ 1.8kOhm

Here's an example part from Vishay Semiconductor, but there are many others that could meet the needs of you application:  https://www.digikey.com/product-detail/en/vishay-semiconductor-opto-division/VO14642AT/VO14642AT-ND/4074374

SSR features:


High current and voltage capacity (2A 60VDC in the case of my example)
Optical isolation in the kilovolts
Low 'bounce' on outputs
Low on-state resistance (often &lt; 100mOhm)
&lt;1ms switching (fast compared to mechanical relays)
Lower discrete part count and sizing