In general, analogWrite is also using Timer Interrupt, and can create crashing issue if used inside ISR and must be avoided. This issue happens so far in many platforms and very implementation-dependent. Only try-and-error can guarantee which platform / core is working OK.
You can see the crashing effect, just by using analogWrite for not-PWM pin, no compile error and no warning at all, just crash.
The correct way for coding inside ISR is just using very short code, possibly just setting a flag, then use a non-ISR timer to check and do real / lengthy / complex works.
Try using Portenta_H7_Slow_PWM library for your simple job.