I’ve seen this with my M1 and M1 Pro machines. I think the biggest culprit is the RAM. 16 just isn’t enough for large workloads no matter how much faster disk IO is. Usually killing off whatever is taking the most RAM gets the machine working well again.