According to Gail Saltz, MD writing for Child Mind Institute:
Having obstacles to overcome is what helps children to build resilience, to develop coping skills to deal with things that are difficult. As they get older, they’re able to say, when facing a challenge, “Well I got through that so I can probably get through this.” Children need to learn through trial and error—this worked, this didn’t work. This is something that parents may have difficulty with, because of course they don’t want to see their children suffer at all. But with no suffering, you build no skills.
To read more on why it’s sometimes good to let your children struggle, click here: What’s Wrong with Helicopter Parenting?