We don't get to control how other people think. (Or feel). That is 'thought control'. And it is both impossible and very, very damaging to a healthy and functioning society.
What we can do, is through social norms, laws, good parenting and education, as examples, is to encourage people to behave in ways that don't harm others. These behaviours, unlike thoughts and emotions, can be clearly observed and robustly evidenced.
Suppose I were to run a small company and I employ someone with Tourette's who shouts the N-word at his black colleagues, and 'Fat C*/Slag/Whore' at his female colleagues, and 'Paedophile' at gay colleagues.
It wouldn't be the person with Tourette's fault at all. He is not racist, sexist or homophobic. Under the Equality Act 2010, I'd rightly have a duty to make 'reasonable adjustments' to support him.
I also have a legal responsibility for the well-being of the rest of my team, and to prevent them suffering harassment and/or victimisation. As an example, under the Equality Act 2010, I have a duty to protect my employees from racial harassment.
Harassment is defined by its effect on the victim. It is not defined by the intent of the perpetrator. Even if the slurs are involuntary, they can still create a 'hostile, degrading, or offensive environment' for the black, female and gay employees.
As the employer, I would be held legally responsible for harassment that occurs in my workplace if I failed to take 'all reasonable steps' to prevent it.
It IS a balance of rights.