TLDR: It's windows forcing sync and causing stutters. Get a capture card or second PC for recording
After many, many months I think I have solved my stuttering issues with OBS and Factorio & Win 11. It was a deep rabbit hole that relates to vsync. Same thing as OP, everything is fine, then suddenly it's like the game forgot how to be smooth, then it goes away, starts after about 30 minutes.
It comes down to Factorio (the game I had problems with) being a windowed game (not exclusive full screen,) and windows FORCING desktop vsync, which creates timing errors when OBS tries to record a frame, and it has to skip it. OBS being a windowed program, also gets vsync forced upon it by windows. Some games you can turn off vysnc, which solves the stuttering, but then the content can look like garbage with tearing. You might be able to fix this with exclusive full screen and no secondary screen(s), but most people who record or stream have secondary screens to monitor what is being recorded.
Having some form of sync is integral to video, and the seeming lack of a "buffer" in this chain creates the occasional stutter. There doesn't appear to be a buffer when recording "internally," doing screen captures or the like.
The main issue here is having the playback computer and the recording computer being one in the same. The source (game) and the destination (obs) need to have sync decoupled from each other. You get this by having two separate computers, one for gaming and one for recording/streaming. When it's the same computer, the content (game and recording program) gets synced together, for better or worse, whether you want it to or not, by windows. I now see why so many streamers have a 2 PC setup, it's not that their computer can't handle both at the same time, it's to get around OBS stuttering issues.
I fixed it by getting an internal capture card. I no longer record the desktop or game capture. The video goes in and out of the capture card, and to my monitor. Zero input lag. Because the content is coming through an external cable and not a screen/desktop/game capture, obs is free to make it's own sync and the video does not stutter. It helps that there's a buffer you can enable in the capture card settings in obs, I'm sure it helps that the card can buffer the video and make it smooth and ready for obs to record it.
It's perfectly smooth now, zero stutters. It's just recording what I see on screen through the HDMI cable, doesn't matter if it's desktop, full screen, exclusive full screen, it's all the same, smooth. I still have my secondary monitors to see what's being recorded and that has no effect on the results.
It really does come down to trying to record your screen as opposed to an external video signal (even if that same signal originated on the same computer) 4K 200 Mbs zero dropped frames zero stutters. Took like a year to figure this out T.T