SUMMARY Demonstrative video: https://youtu.be/oERFSgvhw-k It's a really useful feature to have just so you can detect hanging window you have on front. It's basically the only reason why I still have xfce4-taskmanager installed and in active use. This is a copy of bug 431180
One thing we've really tried to do inside plasma-systemmonitor is surface which PIDs belong to which application and work on groups at a time. With a per-app basis this becomes a lot less of an issue, you can find "firefox" quite easily as per your example without needing to find the root. The other reason we don't want to do this is because on wayland the taskmanager does not have access to windowing information for security reasons, we can't do the mapping like we can on X11. Killing an application by window with the kwin shortcut remains working.
Is this possible nowadays? Window Rules seems to have a button to detect other windows.