Females are super careful about picking a mate because they spend months making an egg. They have a sunk cost. And females are relatively more caring about young because it is cheaper than making a new egg.
This access control forces males to evolve to be pleasing and provide some proof of quality. And this proof of quality can create more of a sunk cost for the male. They stick around and protect the young because it is easier to do that than find another female, impress them, build a nest etc.
Also, sex is very very obvious in terms of primary sexual characteristics. We have literally evolved to focus on those things. But outside of reproduction it is far less obvious in biology. On an individual level it is better to think of sex as an output rather than an input. Things don't happen because of the sex variables state, rather sexual characteristics are a consequence of other processes.