Sometimes it's because we have over-used them. Wheat for one is addictive, the more we eat it the more we crave it. Many people will eat a wheat based breakfast cereal and/or toast, maybe a sandwich for lunch or something in pastry. Snacks may be cakes or biscuits made of wheat flour, and the evening meal may be pasta or pizza. Just because a little of something may be good for you, doesn't mean more is better. In a balanced diet the only thing that should predominate is fresh vegetables, if you want to be healthy. But a lot of us these days put convenience before health without really thinking about it, just by responding to advertising.
I'm not sure what it is in onions that upsets the digestion for some people where it's not inked to mercury poisoning, but a lot of such conditions are actually caused by mineral deficiencies especially of trace elements. Modern farming methods have been leaching the soil of these minerals by not replacing them (for over a century) and have also killed off the micro-organisms that used to enable the plants to take up these nutrients where they were present - a double whammy! The surest way to get these daily essential nutrients back in our diet is by taking a good balanced liquid multi-mineral supplement, unless you are lucky enough to live on volcanic soil that has never been chemically farmed and can drink mineral rich glacial melt water. Then you may live in a state of excellent health to upwards of 100 years or so, as apparently we were designed to do, never ailing till the day you die!
Allergies are usually puzzling and difficult to understand, till you start taking a mineral supplement and they diminish or disappear.