I think it helps to encourage adventurous eating, but I don't know if that helps with immune systems or the child's attitude toward food. My youngest actually has several food allergies despite my very adventurous palate (and hers!). My own unsubstantiated opinion is that the high level of stress I had during my pregnancy led to the development of her allergies. I had a very emotionally manipulative boss who made my life miserable on a day-to-day basis anf I hid my pregnancy from her for as long as possible.
I always marvel when I see kids who are picky eaters. My cousin's daughter would only eat brown/beige food (e.g., noodles, bread, rice, and tofu) and refused meat, veggies, and other foods. She is now an adult who eats more food but I remember being stumped--the foods she ate were the blandest foods with no flavor at all!