I have been using focus.exe to identify the cause. It told me that explorer.exe is doing it. I am on Windows 11 Pro. with 24H2.
It was very clear:
10816:C:\Program Files\Mozilla Firefox\firefox.exe | Mon 09 December 10:06:27
7208:C:\Windows\explorer.exe | Mon 09 December 10:06:49
12716:C:\Windows\System32\ApplicationFrameHost.exe | Mon 09 December 10:06:52
10816:C:\Program Files\Mozilla Firefox\firefox.exe | Mon 09 December 10:06:56
7208:C:\Windows\explorer.exe | Mon 09 December 10:07:00
12716:C:\Windows\System32\ApplicationFrameHost.exe | Mon 09 December 10:07:00
10816:C:\Program Files\Mozilla Firefox\firefox.exe | Mon 09 December 10:07:09
7208:C:\Windows\explorer.exe | Mon 09 December 10:07:14
10816:C:\Program Files\Mozilla Firefox\firefox.exe | Mon 09 December 10:07:18
7208:C:\Windows\explorer.exe | Mon 09 December 10:07:40
By the way, focus.exe and focus-monitor.exe appear to be clones of each other. Only bother with one of them.
So, I did the obvious and closed Explorer.exe, and it stopped. I was pleased, then I had left focus.exe running, and saw that Explorer.exe was still stealing focus. If explorer isn't open, something is using it, and giving it focus, just for a fraction of a second. It only does this while I am doing something else, like typing an email. or a chat on Whatsapp for PC, or typing this message.
Note: If I Alt-Tab to look at/switch to a different window it uses Explorer.exe, so it pops up in focus.exe. You need to pay attention in order not to get false positives.
Bad Microsoft.