That can happen in any monolithic kernel OS. So basically you have two choices: a) Microkernel OS like Redox (still alpha) b) Hypervisor OS like Qubes.
Linux
A community for everything relating to the GNU/Linux operating system (except the memes!)
Also, check out:
Original icon base courtesy of lewing@isc.tamu.edu and The GIMP
Also check your RAM for errors maybe.
I see this often with the firefox memory leak and containerizing it wouldn't resolve the issue, as it's literally freezing due to running out of system memory. Try to make a distinction between a frozen app and a systemwide exhaustion of resources.
If that's the reason for things freezing up, the OOM reaper will come along and sort it out eventually, although it isn't exactly quick on its feet.
Waiting an unknown amount of time to be able to use your computer again is not viable.
I've dealt with this issue across distros and flavors for years and simply accept that using Firefox on Linux the way I use it requires a regular reboot.
Fedora silverblue or another immutable distro maybe?