Thank you all for your ideas, I managed to solve the problem. It was somewhat hardware related, but not really.
I was using BTRFS, which creates a lot of write amplification and aged SSDs don't handle that well. According to a study from 2017, btrfs can cause up to 32x write amplification, absolutely hammering its performance: https://ar5iv.labs.arxiv.org/html/1707.08514
I converted my system to RAID0 using EXT4 and the stutters and freezes are gone.
Thank you all for your ideas, I managed to solve the problem. It was somewhat hardware related, but not really.
I was using BTRFS, which creates a lot of write amplification and aged SSDs don't handle that well. According to a study from 2017, btrfs can cause up to 32x write amplification, absolutely hammering its performance: https://ar5iv.labs.arxiv.org/html/1707.08514
I converted my system to RAID0 using EXT4 and the stutters and freezes are gone.