Maybe the other person let LinkedIn/Facebook access their contacts and then the service sees they haven't reached out to you so it checks if you want to reach out to them.
Maybe their gmail is in sync with contacts in some weird way and that is in sync with facebook. But it was so spooky that I started using facebook strictly in incognito mode.