You seem to be saying insurance companies must discriminate unfairly by saying that if insurance companies discriminate unfairly, they will lose customers.
Say I am male, and I pay more for car insurance because of that. Your argument is that if sex discrimination is illegal, then the market will collapse because women will stop buying insurance. But isn't it equally true that men who are low risk should "evaporate from the pool" in the present system? There doesn't seem to me a fundamental distinction between these two examples of discrimination.
Now, there may be a quantitative difference, a difference in economic impact, but if it's only quantitative, then why should one automatically be manageable and the other not, which is the assumption I think people implicitly make.
It's not actually a value judgement I'm giving. Whether it's unfair as in sex or race based is not part of the incentive mechanism. The mechanism still exists though. If you find out people of one color are bigger risks than another you have an awkward problem.
If you can restrict the companies from doing this you fix the problem, but of course there's games to be played regarding selection, as another commenter notes.
I'm using "unfair" to mean anything someone could call unfair, that is, charging someone as though they are a higher risk than they are, due to some factor.
The point is, it's illogical to say we can't* misprice risk based on ethics or social justice or whatever, when you assume we can misprice risk based on incomplete knowledge. It seems like special pleading.
*can't in the sense of it being a mortal threat to the industry in general
The clean way to do it is to separate insurance (can be very efficient if privately provided) from redistribution (will lead to bad distortion unless done by the state).