Firstly, dinosaurs did not die out after the Cretaceous-Paleogene extinction event, just as mammals didn’t, because birds are dinosaurs. Before we realised they had evolved from theropod dinosaurs (like Velociraptor and Archaeopteryx), we had two separate classifications for the groups - we now have birds, which are surviving dinosaurs.
Second: a whole species can’t ‘go gay’ without reproducing that way, and species with homosexual individuals don’t necessarily reproduce less as a result. This first part of this is a very interesting notion - tied to the very important question of why we have separate sexes or sexual reproduction in the first place.
Many species can reproduce without males. A wild copperhead viper can decide to have a male or female child by herself if the males around aren’t up to her standards - this is called “parthenogenesis”. Some species do away with males altogether, and still “pseudocopulate” - that is, they still engage in something resembling sex, even though it isn’t used for reproduction. The best known of many examples of this is the New Mexico whiptail lizard Cnemidophorus neomexicanus. This kind of sex system - where a previously sexual species loses sex and becomes all-parthenogenetic - provides a huge increase in reproductive rate. It tends to happen in places with reduced disease pressure, like islands, but C. neomexicanus lives on the mainland in the US and Mexico. If a species reproduces and mutates fast enough to cope with the parasites and pathogens it has to cope with, it might not need males, but it might not always be able to economically do away with them like C. neomexicanus did.
I recommend the book ‘Lost Sex’ by Isa Schön, Koen Martens, and Peter Dijk if you want to really understand how we investigate the evolution of parthenogenesis. There is a trade-off to losing sexual reproduction: you don’t get the advantages of recombination that allow selected traits to spread throughout a population, which is believed to be the reason it does not happen very often. The family ‘tree’ of a parthenogenetic species is a series of unconnected branches, each evolving on their own. Some animals, like the water flea Daphnia magna, are clonal throughout the year, then make males in Autumn, so every one of those branches can exchange their ‘winning’ genes in an explosion of genetic diversity, giving them the best of both systems.
As for biologically gay individuals: in some penguin species, and other cooperative breeders, individuals pair up to raise individual eggs. Genes that encourage females to make more eggs by having sex with males also encourage males to pair up and raise those eggs. (This action of genes ‘cooperating’ with themselves across multiple individuals is called kin selection.) While it isn’t a deterministic thing, necessarily, the same seems like it could be partly true in humans - in families which have more gay men than average, the straight ladies tend to have more children than average, and vice versa, suggesting that genes for sexual attraction to one sex or another don’t behave differently in males or females. If you are a man, then the ‘straighter’ your mother is genetically, the ‘gayer’ you may be, and none of that has any negative implications for humanity’s fertility, as the same level of reproduction is happening either way.
While it’s true that natural selection has no foresight, and an organism can evolve itself into a corner and not be able to adapt its way out again, think about it: how could a species of animal ‘go gay’ or have a very high proportion of individuals who only ever mate with the same sex if there wasn’t a selective advantage to it?
If we imagine there were some way a species could go gay and die that way, going back to dinosaurs, so many different species died in the Cretaceous-Palaeogene extinction event (on the land and in the sea) that it’s unlikely to the point of impossible that they all evolved that reproductive system and then died from it at the same time.