I can't tell if you're being really subtle here, but the causality is probably reversed - people ate whatever they could get away with, and over the course of many tens of thousands of years they evolved to process that food efficiently. Anatomically modern humans evolved approximately 200,000 years ago, and agriculture was only invented 10,000 years ago. And industrially produced processed food didn't become a staple of most Westerners' diets until 65 years ago.
The skills necessary to survive on the local available food in one place don't entirely translate someplace else. Somebody had to look at a squid for the first time and decide to eat it for example. Or that the rotting month old cabbage would be a good meal.
Traditional foods are often preagrarian foods in some cases. You can find expensive wild foods restaurants in South Korea for example that serve only food you can gather in the mountains, mushrooms, pine nuts, pine needles, ferns, wild onions, etc. These are things that people cobbled together before they had any knowledge at all of nutrition and amazingly, when we look at them today with the modern eye find out that they represent a fantastically complete diet, rich in essential nutrients. In Latin America you can still find plenty of pre-Columbian cuisine with similar characteristics. And I'd wager elsewhere as well.
Put another way, why didn't they just settle on say mushrooms? How come the entire diet for a people isn't just one food? Or a combination of foods that represent a diet lacking in a certain vitamin? Amazingly, wherever you go, the traditional foods tend to make up a complete diet.
It seems a modern curse that we can gorge ourselves on singular foods and grow fat and suffer malnutrition at the same time. Only today can somebody eat hamburgers and pizza 3 times a day for years.
One thing I've definitely noticed time and again is how complete traditional diets tend to be. It's amazing, thousands of years ago, with no concept at all of nutrition, people managed to put together fantastically complete (and tasty) diets.