Treat the rest as a dedicated, specifically-timed "thing to do" instead of just "time I need to kill until I pick this weight up again."
Timers are helpful, as people mentioned, but stretching, evaluating how that last set went/ how next set needs to go, changing weights, and walking around to catch your breath are great ways to stay mostly on track.
And if you check Twitter after switching songs or something? That's fine. Working out slowly > not working out, so unless you're annoying other gymgoers with 20-min squat-rack scroll sessions , I wouldn't sweat a mental lapse.
EDIT: Ope, I think I misread your comment to mean "between sets" and not just "going to the gym," my b.
It HAS to be a habit. Go to the gym because it's novel and you want to try it out, then try your damnedest to make it a routine. Make it feel weird to not work out. If you fall off the wagon, try again.
If neurotypicals fail to be consistent (see every New Year's resolution), you can give yourself enough grace to stumble, too.
What's the difference between befriending someone who's worse off than you who works in the same building vs someone off the street? Your ability to help them is ~ the same, but you could give them a person to talk to.
They're not aliens, or pets to be taken care of. If a grown-ass man wants to chat with another grown-ass man about something mutually interesting to both, then why bring prerequisites into the equation?
Now, if it's a "we hang out every single night and discuss finances and aspirations and such" situation, sure, I can see a disconnect if the higher-up person doesn't try to help, but your comment almost sounds like a internet-fueled caste system when taken too literally.