I seem to recall in earlier versions, this was not the case. Part of my sneaky buildup to war was to pre-build starbases closeby my enemies' to grab their resources the moment I destroy their starbase so third party civs won't beat me to the punch at claiming the resources I liberated.
Am I imagining it used to be the case you could do this? It now seems to block you from building a Mining or Precursor Relic harvesting modules if the only ones in range are already being mined by an AI. Seems like a rather minor exploit to bother nerfing, if so.