Hi, TomekF,
Thanks for visiting the Apple Support Communities. I understand that you'd like to know if there is a way to prevent notifications from lowering media volume. I'm happy to provide you with some information.
Currently, notifications are designed to lower media volume temporarily to help you hear the notification. While you cannot stop the volume from being lowered upon receipt of an audible notification, you can silence your device while you listen to your desired content. This will allow media volume to continue without interruption while still delivering your notifications. And if you have vibration enabled while your phone is on silent, you may still be able to audibly hear, or even feel, when a notification comes in: How to put your iPhone on vibrate, ring, or silent mode - Apple Support.
Or you can change which apps send notifications in general: Use notifications on your iPhone, iPad, and iPod touch - Apple Support.
If you'd like to see an option to disable the automatic volume lowering in future iOS version, you can let Apple know here: Feedback - iPhone - Apple.
Best!