I’m not sure what you are confused about.
You brought up purpose.
There are no purposes floating around out there. There are my purposes and your purposes - purposes belong to people. What is the purpose of a teacup? Generally, to hold tea. But if I use it to hold small parts, nuts and bolts, then the purpose of that teacup is to hold small parts, until I use it toward another purpose. The purpose is not immutably attached to the teacup - it is my choice, as long as I control the use of the teacup. And my purposes can change.
Any immutable purpose would have to be God’s - unles of course he changes a purpose. But any other purpose is up for grabs, theoretically. For me to have a purpose for a US aircraft carrier - well, it’s possible, but difficult for me to get ahold of one. But I think my meaning is clear.
Assuming I have (some) control over my own body, my purposes for sex are, well, my own. If there is some overiding purpose, I think that has to be argued for, because, so far as I know, I am in sufficient control over my body to have sex with a man or a woman (although, obviously, not any man or woman).
If “replacement level” is the primary value, then still you would have to show why other values cannot co-exist. In fact, in an agrarian, labor-intensive society, and particularly at a time when infant mortality is high, child labor is necessary, and many threats to life exist, it is not surprising that homosexuality is frowned upon. You know, like nomadic, cattlekeeping ancient Jews, for instance.
In a world full of people, in a society of unprecedented industrial and postindustrial worker productivity, I’m not sure such a stricture makes as much sense.