A simple mental habit may help protect people from some of the toughest effects of loneliness and social disconnection.