I think the way a kid grows up has a lot to do with it, but I don't think there's one path. I think it's helpful for kids to be surrounded by adults that encourage them to experience challenges and who consistently express confidence in them and maintain a focus on effort and process rather than outcomes.
A scholastic coach can help this development by creating success opportunities frequently that require the kid to reach to just the next rung. A kid who comes to them full of self-confidence will probably benefit from being thrown in the deep-end once or twice a season. A kid lacking self-confidence should not be thrown in the deep-end. Create lots of opportunities for challenge in practice that you believe are well within the grasp of the athlete. Celebrate the successes and ignore the misses if appropriate focus and effort is being put forth. That doesn't mean you throw a party, but in your own way let the athlete know that you noticed his effort and success. In my own case, I think I begin to expect success and great effort, but too often fail to acknowledge it in any way that is personal.
Once an athlete has a hunger for success and is motivated to do the work, they need to be taught how to get out of their own way. (Until a kid wants to do well and is committed to performing well, I think a lot of training - physical and mental - is a waste.) I think that begins will getting them to be aware of how they talk about themselves and getting them to change it - to change from "I can't" to "I haven't yet, but I will" and eventually to a simple "I will" mindset. I do believe most of the words we speak are simply a reflection of the thoughts in our heads, but I also think that we can change the thoughts in our heads by deliberately changing the words that we speak.
I do believe that mental toughness is a skill that can be developed, but that doesn't mean that everyone can achieve it at the highest levels. In that respect it's very similar to the physical side of running.