A lot of our behaviors and coping mechanisms come from our parents. So if they’re lonely and have no friends, you should examine why that is, and try to change it in yourself.
One of my friends realized after therapy they had a lot of behaviors from their dad. Stuff they hated when their dad did (lashing out when uncomfortable, mostly). Once they saw it, they were able to work on it. Before that, it had been a real source of friction with friendships.













Part of that falls under the “don’t show up when invited” umbrella, but mostly that sucks. I’m sorry you feel like your efforts and friendship efforts weren’t appreciated.
I’ve definitely had a couple friends (“friends”) that were lopsided. I remember posting about one way back in the 2000s on some web forum, and a guy with a otter(?) avatar told me “This guy, that flakes on your plans and only shows up when it works for him? He doesn’t respect you. Don’t put up with that”. Good advice from a small furry animal, I think.
Some people just aren’t worth it. Maybe they were in the past. Maybe they will be again. But I find it’s important to have boundaries for oneself. It can be hard to balance.