I've five weeks into working for myself and avoiding loneliness has become a key task for me every day. I wouldn't say I'm succeeding at it, to be honest. I know I could join a coworking space but I question whether it's worth $400+ a month when I wouldn't be able to attend the networking events since I have a family and need to be home at night. (And I don't need meeting space, and have a desk at home, and etc.)
I've started going to Whole Foods to work during the day just to be around other people. Not that we necessarily interact, but, you know, it's something.