Because the people doing the hiring are morons themselves and almost all people have bias. If left unchecked, they will hire all their inner circle of family and friends which is exactly what happens often.
Its the same reason investors diversify their portfolio via etfs and such. Basically, what we have learned over the decades is that the majority of people are terrible at picking winners and losers and the grand majority of people are NOT self aware of their own bias or stupidity. In fact the inverse is true in many people. In my experience, the stupider a person is, the more assertive and sure of themselves they become. Its a compensation mechanism.
The grand majority of stock pickers under perform the market. This is true for even the richest and most famous investors. Many are surprised at how bad these professionals are after they review their history. Most only got lucky once or twice in their lifetime and failed to out perform afterwards. This is why index investing took off. It doesnt matter whats in the index. All that matters is it is diversified and continuously rebalanced towards diversity. This insures you never have a systemic problem in your portfolio.
As it turns out, this also works in employment. What we are saying is that you should not trust the hiring managers or HR because they are not good at picking people and/or they can be biased or corrupted. So to reduce the odds of bad choices, we diversify across different types of people. Now maybe race isnt a good way to do that. But there is merit to it because race generally comes with differing types of priorities, behavior and attributes.
And yes you are definitely depending on an element of luck. Just like you would when you invest in a diversified fund. You are betting that the diversity will average out good and bad better than without. You are trying to reduce risk. In sports terms, diversification lowers your ceiling but raises your floor, if that makes sense.