macOS 14.2 implemented something like this in Core Audio, but it is not user facing (and also documented extremely poorly). You can create a "Tap" that can capture audio from a particular application, or subset of applications, or an output device. This can then be added to a private or public Aggregate Device (depending on the Tap being private or public).
https://developer.apple.com/documentation/coreaudio/4160724-...