We don't let foreigners vote because, generally speaking,
their interests are less closely aligned with the best
interests of the country compared with citizens. Should we
let foreigners vote now?

s/generally speaking/very specifically speaking/r. Foreigners don't live here and don't pay taxes. That is clear-cut, unlike gender. This is not an accurate analogy.

Now, treating foreigners poorly because you think they're poorer or stupider than you or that their culture is inferior is why we have a lot of hate in the world -- that's an example of society choosing behavior / shaming based on generalization. And clearly that's not a good thing.

Certain racial minorities tend to come from poorer
backgrounds, so we mandate that they receive certain
advantages in hiring and college admissions and so on.
Should affirmative action be ended?

No, but it has plenty of criticism right now in the sense that the actual purpose is to help economically disadvantaged and often what happens instead is privileged individuals in disadvantaged categories benefit the most (not actually representative of who we try to help). Clearly we should seek the most accurate classification and base policy on that. Law should be a scalpel, not a cudgel.

And so the same is with society: we should err on the side of respect and open-mindedness rather than trying to shoehorn everyone into boxes / classifications of our own imagination.

We all sacrifice some of our freedoms to make society a
better place. Why should society not be allowed to take
gender into account when making policies, if gender is
actually relevant to the policy?

Are you saying women should sacrifice being treated as people with agency to make the world a "better place" ? Better for who?

Generally speaking I mean they produce children that become
productive members of society.

Cool so what do you want to say? That subjugation of women will make it more likely that we produce children who are productive members of society? I won't agree with that and you wouldn't have data to support it.

Ignoring facts also leads to people getting hurt.

Ignoring that status quo is not the same as fact leads to people getting hurt. Furthermore, assuming that you can know all the facts leads to people getting hurt. For example, many in society used to say homosexuals can't raise children as well as straight couples, but ignored the circumstances under which homosexuals were forced to live as influencing their classification (persecution). Now that (specifically liberal American) society has become more accepting of homosexuals, you might see that statistically well-adjusted homosexuals are on the rise, and those couples that raise kids do so just as well as their straight counterparts.

In the world you propose, people can say "well statistics show they have higher divorce rates or children make less when they grow up" and use that as a reason to shame gay marriage. And in that world you'll fail to account for the myriad of reasons why that's a flawed notion.

Even if statistics show something, it doesn't mean we should act on it. We don't always know why things are and the various causes, so as soon as you try to blame it on poorly-defined blurry groups such as race and gender, you begin to encroach upon irrational territory. Basing decisions off intractable data is terrible.

I'm not going to bother getting into specifics because it
sounds to me like you wouldn't change your mind even if I
provided such data. It sounds to me like you believe it's
morally wrong in and of itself to hold men and women to
different standards, even if there is good reason to do so.

If there's something we agree on here it's that I'm dubious of any data you'd provide, mainly because I don't believe such data exists. My assumptions and ideologies are formed upon the basis that we actually cannot accurately enough assess this information and thus must operate with a wide berth of respect for one another.

I think of law and society norms as being a shitty x-dimensional linear classifier, and people y-dimensional points, where y >>> x. This is where my disdain for your "data" arises: where you assert you can say some facts for "all women vs all men" and I'm saying you just can't. As far as reason goes, burden of proof is on the hypothesis.

Statistics also can be interpreted with a high degree of variability. So even if my premise was incorrect, and you did "have the data," we'd have to have a conversation about how you're interpreting it.

https://en.wikipedia.org/wiki/Operationalization

^ Turns out with most things regarding people we cannot directly measure / find metrics. Instead we have to satisfy ourselves with operationalizations. So yeah, forgive my skepticism when you claim to have enough data to know the effects of gender norms on societal health when you haven't even done step 1, defining how these things are measured and accounting for confounders.

You know what you can measure? Suffering. You can talk to women and people of color and realize that there are systemic flaws that really hurt people. And you can act on that data, because it's not abstract. You can be kinder.

You're saying there is no statistical relationship between,
say, the amount of casual sex people have and any other
statistic that society has an interest in increasing or
decreasing?

I'm saying that if there is, you can't know it, and even if you do, it's so noisy it's useless to try to base policy on and inevitably hurts people.

Equality for all people regardless of gender, ethnicity, or sexual orientation, is an ideal. If you don't believe in it, we're going to disagree, because it speaks to the core of what we feel is "good for society" or a "good society." If you think of life as an optimization problem, you can think of sum(ideals) as the objective function.

A good society to me is one in which everyone has the same civil liberties to life and happiness. Physical life is not fair (you may be born with a disease and I may not, born rich vs born poor, etc) but that doesn't stop us from saying that fairness is a virtue worth pursuing where we can. Do we at least agree on that?