I have found that re-launching the game serves as a temporary fix. The longer I play, the more noticeable the lag spikes will be, but re-launching the game seems to entirely remove the lag spikes (though they will eventually return and grow longer the longer I play).
I have also been experiencicng this since the 1.21 update. I use an Nvidia graphics card, and in my case, my drivers were out of date. Updating those drivers seems to have solved the problem for me. I don't know if the underlying issue is still present, but it at least addresses the symptoms.
EDIT: actually, no, the symptoms are still here. After a bit of playing the game, it started suffering the same lag spikes again.
Link to YouTube video recording the lag/freeze behavior: https://youtu.be/-AizslDL11s
I updated my Java version to Java 22, and have not been experiencing this issue since.