You need to be a pretty big country with a wide variety of natural resources to be truly independent (for instance, your "independent" agriculture is only independent if you have domestically produced fuel, fertilizer and machinery, etc. etc.) In today's world I think it's pretty tough (how many countries have their own chip fabs and how many don't? Chips go into a whole lot of products indirectly, etc.)
Of course having to protect this very wide range of domestic industries to maintain true independence will result in a huge loss of economic efficiency; so even if it is done right (without an "oops, we forgot the bit about the fertilizer" issue), not only do you have to be a rather large country with a lot of resources, you also have to accept a significantly lower standard of living and a degree of backwardness.
How much it helps I'm not sure; Britain for instance managed to feed itself during WWII even though it relied on its navy for food shipments and of course its cargo ships were constantly attacked. Certainly it did better than it would without a strong navy but with an independent domestic agriculture, since it would have been invaded.
On the other hand, presumably importing vitally important things without exporting vitally important things in return might put you in a bad bargaining position in international politics in times of peace, and maybe then domestic industries making sure that you can survive without imports are helpful; though even that doesn't seem like a huge problem unless you're importing from a cartel (and even very powerful cartels sometimes break down, the way OPEC did recently.)
As to agriculture - I sincerely think it's protected because producers simply bribe the people in the government; there was even research that the more concentrated and bigger ag producers are in a country, the more protected they are (even though a lot of the nominal arguments for protection are much stronger with many small producers than with few large ones typically employing fewer people), though I didn't look deeply into it and perhaps the researcher was biased by expecting this conclusion.