Use of a bulk capacitor with a 5V MCU controlled motor circuit
You need at least to know how much supply ripple your different components will tolerate. This is your starting point.

Then I would draw an equivalent circuit of your power distribution network and the main load (the motor as an inductor in series with a resistor and a switch)







simulate this circuit &ndash; Schematic created using CircuitLab

You will need to approximate/measure the L and R values for the cables going to the H-Bridge and other parts. Do a transient simulation where you open the switch after the motor has reached maximum current. You should see a large oscillation at the voltage input to the R-Pi. Adjust C2 and C3 to reduce it to acceptable levels.

If you cannot measure the inductances, try approximating them using an online calculator.