In order for generative AI to produce a realistic image of a naked child it has to be taught what naked children look like. Real children were abused to train the AI.
We already have humans who can draw CSAM without any actual victims, and the reason for banning such material is that it may encourage future child abuse, which is a very realistic and reasonable concern in my opinion. It's possible that fictitious child abuse may have value in providing an outlet for those suffering from pedophilia, but I personally think that it should be regulated in accordance with the opinions mental health professionals and not left up to the concept of free speech.
Regarding the comparison to objections made against homosexuality, we have to look at what is meant by harm to society. In the case of CSAM it's that real children may be harmed. In the case of gay media it's that more people might be openly gay. These are both plausible outcomes, but the levels of harm are very different. It's fine to risk more people being gay because it doesn't hurt anything; it's not fine to risk children being harmed.