Logged in to say that this has been happening since about November 2023 after the windows update that added the option to group and ungroup taskbar icons. Since then, the issue keeps happening. It seems to start a few minutes after a fresh reboot and is triggered by changing virtual desktops or waking the computer from sleep. Icons become invisible at random and become visible again after changing virtual desktop (Random) or manually clicking them twice (when they do the little jump animation as the window is minimized). It might have something to do with the animations of the taskbar as well.
I tried all solutions in this thread and others, from sfc /scannow, repair health, deleting iconcache and thumbcache from AppData/Local/Microsoft/Windows/Explorer, renaming the regex folders for file associations with .png and .ico files, nothing worked after a reboot.
The only thing that works is pinning icons to the taskbar. When an icon is pinned, it will never disappear for some reason... Still, it's not feasible to pin every single application I'll ever use to the taskbar. Microsoft, get your act together and fix this issue that's been plaguing so many users since 2022!