With Android 6 (Marshmallow), Google has introduced Doze mode to base Android, in an attempt to unify battery saving across the various Android phones.
Unfortunately, vendors (e.g. Xiaomi, Huawei, OnePlus or even Samsung…) did not seem to catch that ball and they all have their own battery savers, usually very poorly written, saving battery only superficially, with side effects.
Naturally users blame developers for their apps failing to deliver. But the truth is developers do all they can. Always investigating new device specific hacks to keep the apps working. However in many cases they simply fall short, as vendors have full control over processes on your device.
So some phones are unable to deliver alarm notifications in the background unless you actively use your device at the time.