Of key importance here is that race, gender, etc. are federally protected classes, while introversion is not. Thus, businesses have way more incentives to curtail discrimination against the former than the latter.
I know you probably didn't mean to imply otherwise, but it's worth saying out loud: that it's not illegal to discriminate against people with poor social skills does not at all make it ok. The context was ethics, not law, as I read it.
Software development is a team activity, thus social skills are important. I don't know if companies are "discriminating" in this area so much as they are simply trying to find people with the right skills for the job.
There is several contradicting data points for what is an optimal hiring strategy for a company. We have the old strategy of making members of a team feel like then are kin, a.k.a band of brothers. The military use/used this a lot and the underlying biological theory is that people will sacrifice self-interest for individuals which is perceived as kin, or as the quote goes a person will sacrifice themselves for either two siblings or eight cousins.
The opposite strategy is diversity with the ability for better adaptation. A team with multiple perspectives is said to better anticipate the need of a diverse customer base.
A third strategy is to look at specific risk. If for example theft by employees are a high risk issue then rejecting applicants with correlating traits with high risk for theft would be beneficial, which would be low social economic status, but those correlate to race and ethnic class.
If we look at the issue from the perspective of what benefit a company the most we end up in many cases with massive discrimination. Thus for social reasons we address the issue as an ethical question.
It isn't illegal, but I wouldn't want to work with someone who has poor social skills. Programming within a team and business is a highly social activity. I would much rather work with someone who can read a room than one who is smart at programming but is completely dense socially or can't communicate well at all.
There's a lot to unpack there, but people in the autism spectrum who can't look at you in the eyes are not necessarily bad at workplace communication (they may fail to realize workplace flirting, but that's a plus, not a minus).
Then there's the whole "benefits of diversity stuff". My team currently has too many generalists/big picture/would-do-well-as-ethnologists-if-not-math-oriented thinkers. Narrower, more focused cognitive styles would do us some good.
But how do you even detect if big picture thinkers and hyperfocused specialists are getting fair chances? The whole interviewing process is stacked against people who can't demonstrate a "wide personality", even for non-leadership roles.