The modern world relies greatly on a vast division of labor, wherein we each do quite different tasks. Partially as a result, we live in different places, have different lifestyles, and associate with different people. The ancient world also had a division of labor, but in addition to doing different tasks, people tended to have expectations about what kinds of people would tend to do what kinds of tasks, live where, and associate with who. Often strong expectations. Such expectations can be called social “roles”.
The definition of a job isn't static. In practice, the exact scope of the job often depends on what those who hold that job are good at doing. So the roles can easily become a self fulfulling prophecy.
In that case, it may be good to have weak social roles even if from an informational content, it's a good prediction of how well it matches the job. Especially in the modern age, where we expect jobs to change all the time (those changes drive GDP).
I've often wondered if Title VII? (Civil Rights Act) outlived its social usefulness. I suspect such a law/regulation was needed in the 1960 but essentially it was (IMO) simply reinforcing some of the basic Constitutional rights and principles (Constitution and Bill of Rights) underlying our legal and political system.
Over time, though, it seems to acting more like what those worried about the Bill of Rights -- if not specifically listed the right didn't exist rather than a general principle that can apply universally. This has led to the litany of follow ups related to sex, gender, physical characteristics...
So now it seems more like one can discriminate all one wants as long as the class is not listed. That is hardly the standard we particularly want (outside purely private settings such as one's mind and home or private setting associates, e.g., friends).
The results seems to be a more divisive society and polity than an inclusive and tolerant one.
But some anti-discrimination laws have nothing to do with roles or economics - e.g. preventing racist name calling.
Even if the only problem is a bad equilibria, it can take coordination via central actions to overcome.
And unless there is some market failure that we must continually fight against, we should expect to need anti-discrimination rules only for a limited time, until new and better equilibria can be reached.If there's no market failure, are "rules" necessary at all? If anyone realizes the mismatch, would you expect the market to start correcting automatically? I recall David Bernstien once justifying such anti-discrimination rules on libertarian grounds, but that was premised on violent retaliation against the first to defect against the discriminatory norm which couldn't scale up to a coordinated mass-flouting of the norm.