Some people were under the mistaken impression that if the pious were going to extremes sometimes, that they should, too, if they want to be pious. Now, if nothing else, this was a noble thought. For those individuals were trying to be especially good and meant only to draw close to G-d in the process. But they were terribly wrong.
(Well, perhaps they weren’t *only* trying to be good because, the truth be known, we oftentimes do the right thing for the wrong reasons: to please others, perhaps; to convince them of erroneous things about ourselves; to hide iniquities by eclipsing them with proper appearances; to adapt into a community, and the like. In any event, we’ll assume that the people Rambam depicted above were making well-intentioned mistakes.)
So, “they afflicted their bodies in all kinds of ways and believed they … were doing good, since (they thought) that was how a person draws close to G-d”. But that’s nonsense, Rambam said, since it assumes that “G- d is opposed to the body, and wants to destroy and annihilate it!” when He doesn’t at all. For as we’d indicated, the Jewish ideal is the right mix of body and soul, and G-d no more wants us to harm ourselves bodily than He wants us to contort ourselves psychologically (by going out of the way to frighten ourselves, for example, or setting out to delude ourselves, and the like).
These individuals “never realized that those were in fact *bad* things to do, and that they’d thus acquire flaws that way” since they were going far beyond the pale, and didn’t have good reason to, as those (few) righteous individuals had when they followed that path (and only for a while at that).
In fact, Rambam likened those in error to “the fool who knew nothing about medicine, who saw some great physicians giving cathartics to deathly ill patients … who were thus healed and whose lives were (thus) … saved”, and who then reasoned to themselves that, “If those things can heal a sick person, then they’d certainly keep a healthy person well and even make him healthier!”. So they’d start taking cathartics for no good reasons, and would become sick!
His point is that if your Spirit isn’t that off, yet you do extreme things to correct it, then you’ll throw it off balance in the process and do yourself far more harm than good.
But some might ask — Why, aren’t we all off-kilter anyway, so don’t we all really need remedies? The short answer is, yes, we do. But while we may all need to add some “supplements” on to our religious practice, few of us should go to the lengths Rambam likened to taking “cathartics”, which are rather extreme remedies that tend to scourge the body and are only to be used under dire circumstances.
For again, we’re to strive for balance and harmony in our spiritual lives, and to only pass the line when seeking true piety — and only to a point even then.