For some reason, Android’s default setting for message notifications in Do Not Disturb is to notify on all messages. This, to me, seems like it defeats the purpose of DND.

You can turn it off or change it by going to Settings > Notifications > Do Not Disturb > People > Messages.

UI screenshot of message notification preferences in Do not Disturb with contacts selected.