I think this line of questioning is reductive and kind of simplistic, in terms of what happens in the real world and what options are available.
I explained in more detail in the same post you quoted, when I answered your question about whether or not it is ever okay to violate individual rights with threats of violence.
I’ll try to answer here without rehashing that answer too much. I think this answer will build off of that one though.
I don’t think I am becoming a collectivist in principle, but we are talking about a law that exists in the real world. I am evaluating it as a tool used by an imperfect society to try to address a real harm in that society.
Worth noting: 100% of human civilizations that currently exist or have ever existed (best guess based on what historians know currently) are/were at least partially collectivist in their system of laws. Part of creating a civilization, a government, a society, involves making some judgments about how people will work together for a common good. And, hopefully, also includes making judgments about how to protect as much individual liberty as possible at the same time.
So within that paradigm, collectivism is going to be present. I am not overly concerned with judging every law solely on whether or not the law is individualist or collectivist.
I don’t think anti-discrimination laws are primarily about society dictating who an individual has to associate with. I think that is more like a secondary effect that occurs when a racist wants to open a business that employs and/or serves members of the community, and wants to proudly discriminate against some parts of the community.
Edit: “Associate with” is a bit vague. Maybe I’m wrong above depending on how you define it. One big goal of laws is to try to smooth things out and prevent major hostility in society. You can own a business and not like black people or befriend them or spend time with them or join their community events or ask them how their day is going, and just coldly and impersonally sell them hardware when they come into your hardware store. You are “associating” in some senses but you also are not associating with them in other senses.
Also: Anti-discrimination laws don’t really force you to associate with people in your personal life, or as a customer, or as an aspiring employee. You can be quite bigoted in all of those areas. The laws only exert force on you if you set yourself up as someone with meaningful power in society (e.g. an employer, a business owner, a goods-seller) who could try to use that power to harm people. Note about harm: society views a denial of service/consideration/etc. as a harm — I recognize that you will disagree. I think it’s complicated, not fully convinced either way.
Also worth noting, you can take lots of steps to be able to be a racist with power, and exert that power in a discriminatory way, even within a society with anti-discrimination laws. For example: you can move to a place with very few nonwhite people, you can refuse to hire/serve people on basis of race but find other plausible excuses and not mention race, etc. Anti-discrimination laws in the US are pretty narrow in focus, because our society does try to balance such laws against individual liberty concerns.