A main part of Judaism is stuff like פרישות and guarding your eyes and thoughts from impurity or fantasies and the like. You’re basically supposed to stay away from any sexual thoughts or whatever until you get married. So how can Chazal tell us this one one hand, but on the other hand the Talmud is littered with stories about sexuality, sometimes even illicit relations committed by rabbis? These stories about taboo topics would clearly spark anyone to begin to fantasize about said topics. Plus, Aggada aside, even any halachic discussions that have to do with let’s say niddahs or all random cases involving women and sexual acts- these would obviously speak the imagination and desire of any Ben Torah.
In short, how can a main part of Judaism be straying away from inappropriate thoughts and desires if a big corpus of our law+stories in the Talmud are centered around sexuality and illicit relationships and whatnot?