The command in your post causes a reset of the M4.
There is no way for the M4 to avoid or to delay the reset and run some code.
Maybe you could send a message from Linux to M4 'before' stopping the M4. This will inform M4 about the imminent stop and M4 can stop the peripherals.
Please also notice that every peripheral's clock that has been enabled by M4 through the RCC registers RCC_MC_*ENSETR will be automatically disabled when the M4 is reset by Linux. I mean, even if the bits in RCC_MC_*ENSETR will remain set, the corresponding clock will not run when M4 is kept in reset by Linux.