The health consequences of a childhood of poor eating are arguably as big a problem as many (but not all) of the diseases we vaccinate against were.
I've not been able to come up with a good argument to distinguish these, other than the health consequences of communicable diseases are more directly visible. Take measles, for instance. At the time a vaccine for it was developed and deployed, measles was infecting about half a million children in the US per year, and about 400 per year died. (40 years earlier, the number of cases per year was about the same, but deaths were about 20x higher).
If your kid gets measles, it is obvious that he's got a serious, dangerous health problem, especially if he is one of the ones who dies.
If you feed your kid in a way that ensures he's seriously obese and sets him on the road to almost certain diabetes by young adulthood, it's not immediately obvious to the naked eye that something is seriously wrong. Kids can have so much energy that even the fat kids can run around and ride bikes and skateboards and be active by adult standards. From an adult point of view, the main visible problem for the fat kid is likely to be social--the fat kid gets picked last for pick up sports games, things like that.
Also, what the parent could have done better to prevent the condition is more obvious with things like measles. Your kid gets measles, and I can confidently point my finger at you and say your mistake was not vaccinating.
Your kid is fat, and I can only speculate. Maybe you aren't making the kid exercise enough. Maybe you don't supervise his between meal eating and the kid has 6000 calories of candy and soda between each meal. Maybe you cook giant portions and make him clean his plate. Maybe the kid is a bully and steals the other kids' desserts at school.
So with measles since there is really only one thing parents can do wrong that can lead to the child getting it, it's easy to force people to not do that one thing. With childhood nutrition and fitness there are so many ways it can go wrong it is hard to force people to do it right. So maybe that's how forcing vaccination can be distinguished from forcing good nutrition?
Should everyone actively undermine the US farming industry, which uses large amounts of antibiotics in ways that could reduce their effectiveness for treating humans?
There are a lot of government policies that, for better or worse, are not set entirely based on scientific merit. There is also, frankly, a lot of "science" that gets presented as evidence in these kinds of debates that isn't very scientific (though I am not suggesting the vaccination question specifically is an example). In any case, trying to shift attitudes towards more scientifically supported positions through threats is rarely successful.
With the vaccination issue, you also have to remember that we're mostly talking about parents trying to do what is right for their kids. Those parents may be ignorant, but again the best available solution to that is probably education and showing them convincing arguments that changing their position really is in the best interests of their child. If you can't make a solid case with real evidence, legislation is just forcing your personal beliefs on someone else down the barrel of a gun, and I think we should be extremely wary of governments interfering so aggressively in the way a loving parent wants to raise their child.
What you propose is legislating the greater body for the unsavory actions of a minority while it is becoming more common with more and more federalization of law it always conflicts with personal freedoms and leads to a less free society for all. Someone would find an action that you do at some point in your life, unsavory and illogical and quite possibly harmful to yourself or others, under what you propose we could just enact legislation for the greater good. This runs contrary to the spirit of the law of the land and ends up somewhere closer to fascism. Please note I am not implying that you are advocating fascism but taking away peoples choice to self determination even for their children certainly starts to lay the foundation for a very different society.
What you propose is a slippery slope on the path to the state raising children which in my opinion is a far scarier reality. Life involves risk, and sometimes it involves risk for children. I think it is fair to say if one has made a life choice that puts other kids at risk their kid cannot participate in activities that could place other kids at risk but it is a whole different level to mandate that we start making medical decisions for parents. If we do we should legally acknowledge that parents or at least the legal concept of guardianship as we know it no longer exist.
You don't get to create people and then go "well I can't do what I want with them, they're not really my responsibility any more".
We got the "Vaccine Revolt" as result, people openly rebelled, and even tried to topple the government (the population formed a riotous mob and assaulted the government buildings, attempting to kill the rulers).
The government had to declare martial law, send troops to quell the rebellion, and internally exiled lots of people (the government sent the "exiles" to the state that was the most distant of the capital, and was also one of the least populous states).
I am very sure that in US, the people that would join such revolt, as the same ones that believe being armed to resist the government is good idea, you do the math.
There's certainly some overlap but to imply that you're "very sure" they're the same group would make you very wrong.
The harder one part of society pulls against guns, the more convinced gun rights advocates become that this is all a bigger conspiracy to to disarm them and take away their agency.
The problem is that a lot of times the restrictions don't make any sense. We'll ban 30-round magazines but not 20. We'll ban barrel shrouds that are entirely cosmetic. We'll ban pistol grips on shotguns that actually reduce the lethality of the weapon by making is less accurate. All the while these things are proposed by legislators who truly do not understand what they're talking about. It's worse than octogenarian Senators discussing the internet, it really is. There you have "it's a series of tubes," and here you have people referring to "the shoulder thing that goes up."
If you could have a well-spoken conservative Democrat who actually understood firearms and the culture surrounding them, who could propose real gun control solutions that aren't based on emotion or cosmetics, you'd probably get something passed.
There are certain things that should be up for public debate and discourse, left to the courts, or up to personal preference. Vaccination is not one of them. "This shot will give my kids autism" is not reasonable and should not be treated as a reasonable concern any more than "Obama is Kenyan" or "We didn't land on the moon" should.