Gender is entirely a social construct very loosely tied to biology but not at all determined by it.

This doesn't sound plausible.

[tl;dr: If evolution didn't build in a powerful urge to make our gender behavior match our reproductive sex, then it made a huge error and missed a very easy and effective optimization.]

It may be the case that gender could be very loosely tied to biology in a philosophical or theoretical sense, but in the world that we're in right now, there are very strong adaptive reasons that gender expression and reproductive sex tend to stay close (statistically, of course) in any sexually dimorphic species, which I'd call a very strong "tie to biology".

Evolution 101-wise, gender can only be allowed to diverge from reproductive sex to a limited enough extent that it's more or less irrelevant to reproductive success. Evolution will make sure of that on a long enough time scale (at least up until the modern era, where we can to some extent decouple reproduction from sex).

If the two diverged commonly enough that animals were often foregoing sex with reproductively compatible partners in favor of incompatible ones that nevertheless matched the gender role they were interested in, then an adaptation that better facilitated reproductive matchings would easily emerge and dominate the population.

Note that such a compensating adaptation might even emerge as some form of social behavior, even if the impetus to that behavior was genetically driven; IMO, this doesn't make it any less tied to biology.

As an example, one suggestion [1] to solve the "gay problem" in evolution (why has full homosexuality, where a person is not at all attracted to members of the opposite sex, not been eradicated from the gene pool, since it should be so devastating to reproduction rates?) is that getting rid of the "gay gene" (or genes, or whatever) is actually a very difficult task for evolution to carry out (I'm anthropomorphizing evolution here for ease of speaking, not because I don't realize why that's wrong) for some reason. Difficult enough so that accepting the ~10% homosexuality rate was a better option, though obviously not ideal. So instead of getting rid of homosexuality, evolution tried to mitigate the "damage" that such behavior causes by enhancing an inclination for people to disapprove of it, which meant that even when people/animals were fully homosexual, they still tended to mate with members of the other sex due to social pressure. Thus the seemingly fitness-devastating 10% homosexuality rate was bumped down to a more ignorable number via social effects, and the presence of the gene was a net win. This is not to say that there's a "homophobia gene"; if this theory is correct, I'd guess that evolution more likely leveraged existing social behaviors (like wanting to fit in, or hating people that act differently) and turned them up to a slightly higher level.

In the case of gender identity, I suspect that there is a heavy dosage of social conformity involved in training people to signal their reproductive sex through gendered behavior. But I think it's biologically driven, or at least that it would be extremely surprising if it wasn't, since it's such low-hanging fruit. I'm sure that these biological imperatives are somewhat flexible, and that if pink was considered a boy color then boys would flock to the pink section of Toys R Us, rather than these things being hard-coded into the genome (though certain behaviors are definitely going to be hard-coded, since sex signaling had to take place before higher-level thought centers could be leveraged). But the inclination to figure out what these socially derived sex-signaling behaviors are is not a social construct - that's an evolutionary imperative, so while we may be able to change the particular expressions of gender that we see in the world, it's probably going to be rather difficult to prevent people from seeking them out and conforming to them.

This is why I'm always uncomfortable with nature vs. nurture questions - the environment that evolution optimizes any particular genome to succeed in includes the entire existing social structure, which was also influenced by previous rounds of evolution. So picking apart what is a "social construct" and what is "biological" is really a fool's errand, when it comes down to it - there's a delicate interplay between the two, and they always play off of each other.

[1] I should mention, there are other theories as well, the simplest being that even with the "gay gene", a person is only sometimes fully homosexual (twin studies have shown that homosexuality is definitely not 100% determined by DNA, though it's not 0%, either), so they do rather limited damage, and if tied to useful adaptations, there would be no particular evolutionary imperative to get rid of such a gene; the point, though, is that such arguments only hold up to a point, and if a large percentage of the population was gay, there would be much more selection pressure against that behavior, tamping down the ratio rather quickly to a lower level.