I’d say most children will display a nascent undeveloped orientation that can be recognised. Many homosexual people report being aware of their sexual desires at a very early age: earlier than the critical reasoning functions that would develop allowing them to make a conscious choice in the matter. They simply develop that way.
The absolute cause is a scientific mystery. People with theological axes to grind will - as frequently evidenced on this very forum - will attempt to make absolute judgements, but the problem is, such black and white outlooks rarely correspond with reality.
I won’t say that homosexuality is decided hormonally, genetically, in-utero or during development. I simply don’t know. What I am certain of is that, for the majority of people, their sexual orientation is immutable. For those that claim otherwise, I suggest that these people that are held up as evidence of mutability are actually fundamentally bisexual and have the luxury (as it were) of being able to choose to land on the heterosexual side of the fence and still be able to live a happy life.
I agree with the Church that the sexual function is ordered towards heterosexual procreation: that’s self-evident and doesn’t need the Church to define it. But the Church has not ruled on what causes homosexuality, and where it has ruled, in the Catechism, it requires us to treat anyone with a homosexual inclination sensitively, charitably and justly and without undue discrimination.