no, getting sick does not help your immune system, regardless of whether you are 24 months or 42 years old. what you are repeating here is an anti-vaxxer take on hygiene hypothesis (claims exposing children to certain microbes aids in reducing allergies) - microbes not viruses
masking a non-immunocompromised baby is genuinely abuse just nerfing their immune system for life, ironically making them immunocompromised later