So do to the current extremeness and sensitivity between anti-vac and and vaccinated individuals this response will only be tailored to what has been seen in scientific experimental evidence and what is though in your standard college/university microbiology and immunology courses. So in regards to your question the most simplest answer is that you are correct. Vaccines work to give the immune system an advantage on being prepared for encountering a foreign microbe or virus through stimulation of a small immune response to generate memory cells to gain s faster immune response if encountered later in life. This holds true because most vaccines are made from dead viruses, dead pathogens, and.or parts of the pathogen such as a protein from the protein coat dealing with pathogenesis usually tied to an adjuvant to make the vaccine work better.
Now when we are little and during the course of our life we are highly recommended to obtain vaccines at various months within the first couple of years of life to prevent infectious diseases such as dTAP, chicken pox vaccine, MMR, HPV, etc. the reason being is that during pregnancy we are "sharing"our mothers immune system through selected antibodies sIgA*, IgG, IgM from which some can pass through the placenta. When during birth if going through vaginal pathway we as individuals obtain certain bacteria tied to that pathway while those undergoing a C-section obtain micro bacteria that colonize the skin which can lack some organisms seen in the vagina canal. Now since we are born we don't have a built up immune system because we haven't been exposed to anything to mount an immune response which is why its important for breast feeding because babies can continue to obtain small amounts of the mothers Ig (immunoglobulin or antibodies) while building up an immune system.
Now being vaccinated not only protects yourself but also those who can't obtain a certain vaccine for a certain disease due to a number of reasons (more medically) such that they are immunocompromised which can been seen with children undergoing chemo, blood disorders, immune system disorders, etc. through this indirect protection through vaccinated people is called herd immunity. This has been keeping diseases in check ever since the introduction of vaccines many years ago and which is why now we don't see polio because we are vaccinated against it (three countries still have cases of polio) and better yet smallpox which has been eradicated overall. if the amount of unvaccinated outweighs those who are vaccinated trouble arises because the pathogen has more hosts that it can spread to quickly even if one is vaccinated because you have more simultaneous encounters of the pathogen through unvaccinated hosts aka herd immune is no longer working. This can be seen now in the news in various states declaring a state of emergency because of high cases of measles out breaks. This then means that the pathogen can spread even more quickly amongst unvaccinated and vaccinated people through its high contagious rate with ease for it only takes inhalation, touching or open cuts or wound or access to the mucous membranes for the pathogen to enter and do it business. The pathogen doesn't care if the host has been vaccinated or not its main concern if it can overcome the immune system and reproduce and continue to move on.
This is why organizations such as CDC, WHO, FDA are strongly fighting to make laws harder to prevent "laid back" excuses to prevent a child in become vaccinated. This is also why they are making people stay home if contracted the disease so as to keep it confined and reduce chances of spread to not only immunocompromised individuals, the elderly, pediatrics, and the general population. One would be able to see that once more people become vaccinated, herd immunity will rise back to normal and outbreaks such as MMR will dwindle back down to normal again or nonexistent in the United States like it was before.