There's no shortage of places to run into spam. It seems like nowadays, all you need to do is open a new email account, and there will already be spam in there waiting for you. Alright, that may be a slight exaggeration, but the problem was bad a decade or even twenty years ago, and it hasn't slowed down.
Many companies push out spam protection for this very reason, but its effectiveness is largely hit-or-miss. Google is likely one of the top guardians against spam out there, but even Gmail is prone to filtering out legitimate messages (which is why you should make it a habit to check your spam folder periodically). The lowly SMS chat isn't even safe. It's actually almost too easy to send an SMS, because you don't need to know the person who owns the line - you simply need to know the number exists. That's perfect for automation, when there are a fixed set of possibilities. That's not the case with email addresses, which can include wild variations from one to the next.
Thankfully for Android users, Google has been on top of developing a solution to combat this problem, and it'll come to us in the form of an updated Messages app. It's a feature that will be automatically enabled, but you can venture into the settings and disable it if you choose. As with its other spam protection features, Google will scan messages to detect spam, but it's being super clear in that it will not store your phone number, and the same goes for your content.
Google's Messages app for Android
The spam protection is enabled with Messages v3.9, but requires a server-side update before it is fully functional. There's no telling when this feature is going to hit you, but it seems likely it will be fairly soon. If you're an avid Messages user, you'll undoubtedly see the feature the day it becomes available to you.