"fix upstream Android bug in DeviceIdleJobsController which was preventing battery optimization exceptions from fully working for system apps and resulting in delays in some cases for the Messaging app and other system apps"
I normally execute the following during the setup process using USB Debugging:
adb shell dumpsys deviceidle whitelist +com.android.messaging
adb shell dumpsys deviceidle whitelist +com.android.phone
The above code fixed message delays for me.