This is a nice concept, but I owned more than one Android phone that would ignore the battery optimization settings and kill the applications anyway.

I have been working and running ntfy [1] on my phone for a year now (ntfy is a UnifiedPush distributor), and it is true that Android does kill the app every now and then. But it is instantly restarted. Usually ntfy delivers notifications much much much faster than Google's FCM, especially in doze mode. FCM seems to try and conserve battery much more.

Disclaimer: I am the maintainer of ntfy.

[1] https://github.com/binwiederhier/ntfy