I think XMPP got attacked not because of the fragmented ecosystem of clients, but because the standard itself (in the sense of the complete set of XEPs in existence) got fragmented. As far as I know, multiple competing/overlapping XEPs were not an uncommon situation.
Compared to this, the Matrix standard(s) have thus far been able to maintain a certain kind of coherence (IMO), allowing for at least a vision of what a complete implementation of a server or client should look like. The standard is versioned so that you can aim for support of a particular version instead of a pick-and-choose subset of functionality. Also, part of the Matrix's coherence story probably lies in the fact that there is an "official" set of clients in the form of the Element clients.
Ultimately, you cannot prevent others from writing incomplete servers or clients. But you can show what the goal looks like and have other implementations approach it asymptotically.