The majority of people don't just go like "I'm going to end my entire IRL social life and pretend I'm BFFs with Dr Disrespect now" Some might, for all I know. But that would probably mean even more serious psychological problems.
For a lot of people , engaging socially online is just a way to keep some degree of social interaction in their life. Together with things like gaming communities and such of course.
20 years ago people didn't have that option, so they just stayed inside and did solitary hobbies instead.
It's important to note that anxiety rates increased less than 2% the past 15-20 years. Though the highest increase were in young adults 18-25
Which is expected as the population also increases.