Vaccinating against "feelings" is very different from vaccinating against "ideas & beliefs"
Chemically preventing a person from experiencing certain feelings is something we do all the time. We give people antidepressants to keep them from feeling sad, or if you want a more permanent fix (like a vaccine), there are surgeries to remove or reduce the size of various hormone creating glands, and then there are things like lobotomies that simply prevent your brain from consciously acknowledging your feelings by destroying the necessary neural pathways for processing them.
So in theory, you could develop a chemical designed to kill off the cells used by specific glands responsible for certain feelings; so, you can plausibly vaccinate against feelings.
However, ideas & beliefs are a completely different issue. Beliefs are a function of your general learning system formed by pairing experiences with feelings. By preventing a certain kind of feeling, you can prevent people from learning certain things, but you will completely prevent them from learning anything which relies on that emotion. So, if you vaccinate against hate, you can prevent people from caring about issues like race and gender, but you will also prevent people from caring about issues like homicide, rape, and theft because we are supposed to hate those things. Instead of making a more tolerant society, you will get a more apathetic one where people will mistreat each other indiscriminately without any real consequences.
So, if you want to change a specific belief, you need to change the specific experiences that form and reinforce that belief rather than the learning mechanism itself.
The Solution: A Curated Mass-Media Monopoly or Trust
Algorithms like those used by many popular social media platforms are designed to present you with information that already appeals to you too stimulate you to further use their platform. Each one of these interactions forms a learning experience. After about 6 months of regular use, such a platform will typically radicalize a person by exposing them to repeated input of information that they already sort of agree with until they strongly agree with it.
Let's say using one of these platforms, you look up "Why did the US Civil War Happen?" Your platform will look at your search history and try to find an answer that will appeal to you; so, if you have a bunch of racist stuff in your search history, it is more likely to point you to articles about State Rights, Asymmetric Representation, and stuff like that, but if you you've done a bunch of searches about civil rights issues, it will return a bunch of stuff about Slavery. In each case you will become more sure of your previous opinion and become more resistant to the opposing opinion, in effect, immunizing you against anything that opposes the view that is being repeated to you.
However, mass media algorithms do not need to present you with things you already agree with if they have a true monopoly power. If instead of having a bunch of competing mass media systems, there was only one option, people are much less likely to leave your platform just because they do not like everything that they are reading.
Now your platform can answer questions however it wants; so, even when you ask a more pointed question like, "Did the South seceded from the union because of asymmetric representation?" the only results you will get will be debunking artiles say that, no the South only seceded from the union over issues of slavery; thus, shifting that user's perspective to agree with a point that they were previous opposed to: effectively "vaccinating" that person against racism by countering racism's formative experiences.
Modern AI is good enough now at categorizing search information to the point that computers can tell if an article or website is racists, xenophobic, sexists, etc. So, if a modern platform where to start trying to immunize against these thoughts, all they would have to do is censor everything that supports them and show you the opposing view every time you try to reinforce your beliefs.
Major ethical ramifications
1 - It clearly violates freedom of speech by suppressing minority opinions. Only some people will be able to express their view via mass media; so, if you are racist, sexist, etc., you will be denied representation both at Government and Interpersonal levels. It could also be said to violate freedom of Religion on the level that you are not just dictating what people can say, but also dictating what they can believe. Suppressing ideas because you disagree with them is the definition of totalitarianism. Democratic rule only works when all opinions are allowed to exist.
2 - This leads into a second major ethical issue which is that you are destroying the truth. Many cultures today believe in the adversarial system where truth is best found by seeing opposing points of view supported by the strongest possible evidence each side can find. This is why it is so important in a courtroom for example to have both sides represented by a lawyer. A skilled lawyer who does not need to argue against another skilled lawyer to prove his points will win pretty much every court case regardless of the truth. But in cases where there is only one logical truth, the more compelling argument will generally win out.
So, in your society, any idea that might even be related to a censored topic will also be "proven false" even when it is true; so, anything that tries to explain anatomical, cultural, or psychological differences between people will also be censored. As it turns out, there are many medicines, goods, and therapies that are race, culture, or gender specific; so, if you censor all if it, then you also hurt a lot of the people you are trying help by suppressing any product or service that is specialized to fit their needs.
An example where this has happened in real life is the pain medicine industry.
Men and Women experience pain through different neurological mechanisms. Men experience it through the same mechanism that governs feeling sick, whereas women experience it through the same mechanism that governs feeling emotions. Because Feminism labeled these early claims as sexist, research into it was suppressed preventing pharmaceutical companies from funding research into gender specific pain medicine. As a result, women today are expected to take pain killers designed for men; so, they are not nearly as effective which has in turn lead to a whole new gender bias as women seeming less tolerant of pain because of how much more pain medicine they request from their doctors.