I can reproduce ugly macroblocks in the same two spots of an H.264 MP4 only when hardware encoding is enabled. Software encoding of the identical range looks clean. Is that enough evidence to focus on the GPU encoder/driver?
It is strong evidence because you changed one major variable. Keep the short reproducer, update or roll back the GPU driver, and test another hardware quality preset before changing the project itself.
Match bitrate, GOP and profile as closely as the software and hardware paths allow. A fast hardware preset can use different rate-control decisions, so compare equivalent settings rather than only the H.264 label.
Color & tone mapping
For a final master, reliability beats saving a few minutes. If software encoding is consistently clean, use it for delivery while you troubleshoot hardware separately.
Codecs & export
The fact that the corruption repeats at the same frames makes this much easier. I will preserve that short range as my driver/encoder test case.