I've had this issue for more than a year on my S21. The notification sounds stopped working unless there is media playing. My phone will ring when I receive a call at any time without issue. I can change the ring tones to preview them and it works as it always has but changing the notification sounds don't. However if there is media in the background it will play the notification sound and it will play the preview sound when selecting a new tone. Except the media stops playing when selecting a notification sound and I have to start the media to get the notification preview sound to work.
I've tried everything I can think of and everything I have read. I have tried safe mode and I have even done a factory reset several times. This has led me to believe its likely a hardware/speaker issue. Hopefully that's not the case and someone has a fix for me.