On iOS, it appears to be possible to end-to-end encrypt notification payloads, so that they only get decrypted locally on the recipients device: https://stackoverflow.com/a/42073503
In that case, Apple would not have access to the message content contained in the notification.
However, do apps like Signal actually do this?