I think this was the same problem I had - the cause was the option:
Settings - Sound & vibration - Do not distrub - "Auto turn on in immersive mode"
Switch this option off.
This option actually makes no sense to me and it seems it might even be enabled by default 🤷