I suspect this is part of it, but I also suspect that it's even little things like more people living in dense cities and spending less time in serene nature.
The rise in near sightedness is tied to kids not spending enough time outdoors literally just focusing on things far in the distance, it seems to me that it would be more surprising if there weren't also related mental health consequences.
I was born and raised in the third largest city in North America and still live here. Gtfo of here with your baseless assumptions.
City life is efficient and culturally awesome; the country and nature naturally induce senses of calm, peacefulness, are empirically shown to reduce stress in humans, and is where we evolved.
Both of these things can be true.