I think that's a symptom of the provider you chose, not the XMPP sphere itself. I've used Jabber/XMPP for just over 15 years and while I've seen plenty of bullshit going on in various highly popular MUCs (join-floods, phishing attempts and such) I've never personally been subjected to spam directed at me.
I have joined XMPP rooms via Matrix and have already gotten spam from XMPP this way
Which is surprising since XMPP allows you to hide your global address in public rooms and Matrix doesn't (unless they fixed it by now?).