This issue was related to an old macOS optimization called "detached mode" or FSLP (fullscreen low power). There were related bugs in Chrome and Firefox:
- https://issues.chromium.org/issues/41359717
- https://bugzilla.mozilla.org/show_bug.cgi?id=1747999
macOS skipped compositing when only a single fullscreen surface with a black background was being rendered, but there were many ways for that render path to misbehave.
It only ever affected integrated graphics on dual GPU Macs, as far as I can remember.
Detached mode still exists on Apple Silicon. If you enabled the Metal HUD in a game it will tell you whether the game is rendering in Detached or Composited mode.