You're betting evolution is not that good. One can also bet it better than you can possibly imagine. I don't think you can be sure either way at this point, but your argument seems to be the most compelling at this point!
Our genetic code doesn't include statements like "if (is_male) { try_to_have_sex_with_ladies(); } else { try_to_have_sex_with_dudes(); }".
Our genetic code produces proteins of different shapes and those shapes influence the development of the structure of our brains and their function and that brain generates feels of various kinds that lead to attractions of various kinds.
Evolution works by changing the coding of the genetic code which changes the shapes or amounts of proteins produced which changes the development... a local maximum happens when the final system produced (our feels of attraction) would be negatively affected by any individual mutation on the genetic code. There may be better feels-of-attraction systems you could build from scratch that would propagate the species better than ours, but you can't turn ours into this better system without making it worse for awhile.
Nature can't make arbitrary changes; it can only make incremental changes. And consequently, we frequently get stuck at local maximums rather than global maximums.
If a particular gene causes good things 95% of the time (based on other interactions or developmental factors or whatever) and catastrophic failures like heart disease or cancer or crippling depression 5% of the time (and it represents a local maxima, with no simple improvements possible), then it can easily come to dominate a gene-pool, so long as the 95%-benefit outweighs the 5%-failure. It doesn't mean the 5% failure has been "selected for", it just means that it wasn't worth weeding out.
Moths circle lights because of genetic factors which influence their tiny moth brain's development. It doesn't mean that circling-lights was a selected feature.