I know how to get the audio stream names, the problem is the window titles. With X it's easy, just call xdotool. I'm sure it's probably easy enough on Windows and MacOS too. Wayland is the weird one for making focused window titles privileged information.
Anyway, I do think I've created what should be considered basic desktop functionality here, a simple hotkey that mutes or otherwise changes the volume only of the focused window. Every desktop should have it.
This is just one of the tools I've made for myself with X which I do not want to do without and this makes Wayland a non-option for me. If I can't use X and can't replicate things like this with Wayland, then maybe I should switch to MacOS at that point because the dream of controlling my own computer seems like it's dying anyway.
Wayland is approximately correct in this case and Windows and Mac are behind the security curve for bincompat reasons; window titles certainly leak PII. There should be a way to do it, but it is sensitive information.