I know this is an old thread, and a few posts back from this, someone mentioned Greenify.
First, I'd like to clarify I'm on Android 12, rooted.
In my case, the app "Microsoft Family", I wanted notifications to come through on the lock screen were never working.
I have battery -> background...