That's not how that kind of vax works though. It doesn't completely confer lifelong so-called sterilizing immunity. No vax is actually a 100% shield. The measles/MMR jab is much more effective though and once you have 2 doses of it you are probably safe from measles for life.
By contrast, flu viruses mutate so rapidly that each year a new vax is required to combat the various new strains that appear, and that's why a new vax has to be produced each flu season to combat that season's latest strains. So far, no one has developed a vax that can offer longterm immunity for this so annual shots are required, especially in older people.
The vax won't necessarily stop you getting infected with the flu or even developing mild symptoms. Its job is to allow your body to defend against those symptoms so you don't get very sick or die.
Most flu vaxxes in the US and Europe are inactivated vaccines. So the virus is "dead" and can't infect you. (Viruses aren't actually alive in a strict sense anyway, but it means they are inactivated so they can't replicate.)
It's just the presence of fragments of the virus's genetic material in your system that triggers an immune response and trains your immune system to recognize it if you do get infected with the actual virus.
Like training security guards/police to recognize the faces of known criminals or something from photos. Then when the actual criminal walks in with a firearm they can apprehend them quickly. Rather than an unknown stranger who walks in unnoticed and commits a crime for the first time and it takes them a while to act, by which time they might have done a lot of damage or shot someone.
And of course they mutate. So next year, a new flu gangster turns up who no one recognizes, until their photo is circulated and security can spot them again.
There are some live attenuated flu vaxxes that use a weakened version of the pathogen. (So a bit like bringing in the criminal unarmed and in handcuffs surrounded by bodyguards.)
These are used less and mainly given to younger healthier people (with stronger security guards). It is very rare to actually catch the flu from them but not impossible in immunocompromised people. A bit like if the security guards were few in number or weak and elderly, and the handcuffed guy broke away and started running round kicking people. But the risk is still low, and much lower than leaving your building unattended for the gangster to just walk in with a shotgun and let rip (or "RIP")