Was the messaging app still open when the phone locked before? Or does it unlock to the messaging app regardless of what was on the screen before it locked?
It does not seem to matter whether or not the app is closed completely or if it's open and I've been using a different apps that app always opens up when the screen unlocks
Does it happen in Safe Mode? https://support.t-mobile.com/docs/DOC-28008. If not, then something you installed is causing it. it can be challenging to pinpoint the culprit, though -- you may have to uninstall apps one by one.