It depends on which one of you finishes first as to who gets to keep the territory. However, both of those are able to still function in remote territories -- they can't be built fresh, but they are able to "contest" the territory. So then you can duke it out presumably and whichever building lives the territory will belong to. If the AI finishes their building first but then you nuke their building via something remote, then it would flip to no owner until your building finished, and then to your building.