Can SW Debug/ST-Link issue hw reset
Not sure if this applies to you but I’ve occassionally used the STM32 ST-Link Utility to reset the hadware (I sometimes develop remotely through VNC to my home machine that is connected to my disco board).
Also, I use IWDG (independent watchdog) to reset the board when it becomes unresponsive. If you can set them it with a simple timer early enough in your main(), this might save you some frustration. Basic concept is your code has to reset the IWDG periodically or else the handler will reboot.