you can find all of this in the summa theologicae, II-II, q. 154, art. 12 at this link: ccel.org/a/aquinas/summa/SS/SS154.html#SSQ154A12THEP1
it may be wise to read the whole question. also, it is not written to express any practical opinion about a particular sin. this is a theological question. if one were to ask st. thomas which he would more highly recommend, i’d guess he’d say, ‘masturbation’. since he would see it as the guy is going to hell either way, so why involve someone else. the point is, he is not answering the question, “which is the greater social sin?” or “which sin is more damaging in the social arena?”
picking a particularly unpalatable statement and presenting it as representive of error, is the preliminary steps of rejecting reasoning in regard to dogma altogether. i am sure that the author cited had a wider project of denying Church teachings concerning sin and chastity. this is just one element of the project. this kind of fallacious method tries to cause people to think ‘clearly, he has said something so absurd that he doesn’t have the ability to reach proper conclusions on other matters either.’ i am sure that if you hold to st. thomas’ conclusion that masturbation is worse than rape, the author’s further conclusions about sexual morality would seem absurd.
btw, i’ll bet ya my last beer that if a man never masturbated, and habitualized sexual orgasm through mental fantasy, he would not ever become a rapist. rape is not just a singular act of the body, it is an act stemming from the disposition to do the act. if a drug analogy fits, masturbation is the marijuana and rape is the heroin. or the moral lesson ‘start out steaing candy bars and before you know it you’re stealing a car.’ prevent one sin and you’ll likely prevent the others. maybe st. thomas knew something afterall.