It seems to me this only happens if you don't use the app much. Or maybe some apps are "allowlisted", I've never had delayed WhatsApp/Slack notifications.
Unused apps also indeed go in different App Standby buckets, which while it shouldn't affect FCM notifications, it does on some older android versions (https://developer.android.com/topic/performance/power/power-...)
If you're not using FCM, well you're limited to having to check for notifications yourself, either within doze windows, or by registering a foreground service that keeps your app alive and checking.
I don't know exactly what the option is called but since Android 8 there is at least a toggle there per app. Later versions have lots more settings.