Excellent question for us to consider!
My psychiatrist friends feel that resilience is often inborn. However, the operation of what we call "individual differences" may account for some of the success vs. failure, no matter the environment. This is similar to two individuals highly exposed to a cancer-causing substance; and one contracts cancer, but the other does not - these can be unrelated persons or even identical twins. Identical twins sometimes differ in resilience and ability to thrive (thrive as infants and function effectively as adults).
A more serious problem is lack of self-starting, which may have a larger origin in the environment -- We find that children ages 5 or a little older down to toddler, when they are not permitted to talk, play, exercise, or even move around very much are often unsuccessful adults. They sometimes suffer some brain shrinkage/atrophy, *expressive language disorder*, any of the aphasias, or stuttering, lack of physical coordination, and problems with logic and problem solving; all of which can negatively affect the IQ and social skills. In addition, I have seen cases in which parents have over-controlled these younger children, hampering both physical and intellectual development as a result. The more-resilient child may overcome some of this; the less-resilient child may suffer more. Either of these children, when placed into an enriching environment, can improve.
Rich or upper-middle-class kids who have everything done for them can "look like" the over-controlled kids in lack of self-starting and ambition, but that's another whole topic.
These are only a few of the considerations that have filled entire textbooks and parental guides. Good luck to all parents and children out there!