Everyone always gets the causality reversed. Social media didn't cause the epidemic, it filled a niche to help cure the epidemic. People were lonely long before the internet arrived, the internet just made it easier for those lonely people to connect to each other. And now many of them prefer the internet over socializing with people they don't care for that much in person. In other words, the problem is structural.…
Yes of course people were lonely before the internet and social media, but that pushed them to go outside and solve the problem. Now they do the digital equivalent of taking drugs to make the problem go away.
Prior to the internet people were staying home and watching TV. The dynamic is much longer lived than you think. Check out the book 'Bowling Alone'.