Our samsaric condition constantly demands food, water, crapping/pissing, freedom from pain, and sleep. We need these for our bodies to survive, and our bodies tell us these are the best things ever. However, our condition also demands entertainment, pride, renown, friends, love, etc. and yes, sex. Then these non-survival needs get happily lumped into the same category, and our bodies and minds tell us they're the best things ever. Since we're all addicts to samsara and a captive audience to our own steady stream of BS, it's hard to distinguish between what's actually sustaining us, but what isn't starting wildfires of karma to further enmesh us in samsara. We become so used to giving in to craving that anything else seems impractical, useless, or even scary.
So for some things, you try doing the opposite of the usual "omg this is great" feedback loop that keeps us locked in, and try viewing it as repulsive. Does it then become repulsive? If viewed from a different enough angle, it sure does. Well, that tells you more about the nature of views and our personal narrative than it does about sex, entertainment, or anything else. It helps loosen our grip on ideas of a solid external object that our internal selves apparently need. After all, it's not like the equivalent of mixing our pool of salt water into the ocean does much of anything at all, ultimately. It's the karmic impact of constantly repeating the refrain "me = needy self, out there = gimme gimme!" that acts like a self-fulfilling prophecy, literally. Few things do that as strongly as sex and the desire for sex do. The good thing about sex in this regard is you don't need it to survive, so you can dispense with it until you reach some state of realization
If you want to, that is.
So I think the Buddha's goal wasn't to say sex or anything is repulsive per se. He's using skillful means like always (he's the Buddha dang it!) to get people to stop believing the stories they tell themselves. You use the stepping stone of viewing things as repulsive to break the spell of samsara, then see what you can see from there. Disenchantment is the name of the game, the Middle Path, not attraction or aversion, as you said dharmagoat
I believe this is relevant... sorry I don't know how to cite numbers and chapters of sutras! This is only partial because it's long
"Monks, when the uninstructed worldling experiences a painful feeling, he sorrows, grieves, and
laments; he weeps beating his breast and becomes distraught. He feels two feelings--a bodily one
and a mental one. Suppose they were to strike a man with a dart, and then strike him immediately
afterward with a second dart, so that the man would feel a feeling caused by two darts. So too,
when the uninstructed worldling experiences a painful feeling, he feels two feelings--a bodily
one and a mental one.
“While experiencing that same painful feeling, he harbors aversion toward it. When he harbors aversion toward painful feeling, the underlying tendency to aversion toward painful feeling lies behind this. While experiencing painful feeling, he seeks delight in sensual pleasure: For what reason? Because the uninstructed worldling does not know of any escape from painful feeling
other than sensual pleasure. When he seeks delight in sensual pleasure, the underlying tendency to lust for pleasant feeling lies behind this. He does not understand as it really is; the origin and the passing away, the gratification, the danger, and the escape in the case of these feelings. When he does not understand these things, the underlying tendency to ignorance in regard to neither-painful-nor-pleasant feeling lies behind this.
“If he feels a pleasant feeling, he feels it attached. If he feels a painful feeling, he feels it
attached. If he feels a neither-painful-nor-pleasant feeling, he feels it attached. This, monks, is
called an uninstructed worldling who is attached to birth, aging, and death; who is attached to
sorrow, lamentation, pain, dejection, and despair; who is attached to suffering, I say.