Years ago, Izzy wrote an answer stating that this desirable feature likely was not possible in most Android builds at that time.
Well, fast-forward to 2021, and it appears that it still is not possible in most Android builds.
Quoting from Yogesh Dama, a skilled Android developer, in the current release notes for their app WOW Volume Manager:
Note: app can change volume levels only if you open the app which you configured. there is no possibility in android to change volume levels for background running apps. only apps those are on foreground and open by user, only for those app automate volume control can work.
The keywords in that quote are "there is no possibility in android to change volume levels for background running apps". When you have one app in the foreground, all other apps are in the background, and Android still provides no way to control the sound volume of background apps.
(Note that WOW Volume Manager allows you to change the volume per foreground app.)
There are ways around this Android limitation: App developers can include different sound clips pre-recorded at different volume levels with their apps. They can also dynamically generate sounds at different amplitudes. Finally, they can allow selecting frequencies that humans perceive to be at lower volumes. After implementing one or more of these techniques, the devs can then can allow users to select a volume profile for their specific app, which will work even when it runs in the background. I don't know of any apps that actually do this, but it's certainly possible.