Sharing GND with a device
What you have described won't work.  That's because when you open the ground leg of the R-Pi, all of the output pins will float HI.  This includes the GPIO pin that feeds Q1.  Thus: Q1 turns ON, discharges the timing capacitor, which turns on MOSFET M1.

There are a couple of options you can explore.

1) Switch the R-Pi +Vdd pin instead of the ground.  This is the preferred method for many reasons.

2) Use an opto-isolator where the opto's LED is driven by the GPIO pin (with suitable series resistor) and the opto's transistor discharges the timing capacitor.

My great preference is to do option (1) above.