applets/taskmanager: Fix missing window thumbnails on wayland
Disclaimer: the issues at the heart of the bug are pretty weird. I don't have the absolute understanding why things go south, and debugging that is very difficult, or even building a minimal reproducing app. In either case, I made the changes solely based on knowing what's less likely to break or cutting something that can be cut.
See the individual commits for more explanation.