Actually it was a small world back then, as the whole population of English on the planet was about 6.5 to 7 million. Compare that to the 8.27 million people living in New York City alone today. The population of seagoing men was quite small as going to sea was still seen as a last resort for most landsmen. Selkirk himself went to sea to avoid a magistrate's hearing. As for circumnavigators, a very small population indeed. Extrapolate that out to the population of pyrates and should be of little surprise that a number of them knew each other.
Hmmm wasn't Dampier involved or at least present,in both the marooning and the rescue some how?