Are you sure it is a gateway, not a wormhole? From the Wiki:
While exploring the galaxy, empires can find abandoned gateways that were once part of a massive, galaxy-spanning network. Reverse-engineered from encountered abandoned gateways, these megastructures require the Tech gateway activation.png Gateway Activation technology and can be used to travel directly to any other active gateway in the galaxy. As opposed to wormholes, both gateways must be owned by the same empire or an ally empire in order to be able to travel through them.
Wormholes on the other hand, work in pairs and can be used by anyone, including enemy.
So all gateways are connected to each other, but you need to own/have access rights on both ends. In case of war, you can't use the gateway to get into enemy territory. At least you shouldn't, but this Steam thread suggests that you can use a gateway that you've originally owned, even after loosing the system during war.
Another possibility is when your enemy is a Fallen/Awoken Empire - I've noticed that they seem to have some supernatural control over the network (after all, THEY'VE built it) and they seems to be able to use more gateways that they should - I had them suddenly appearing in my system from the gateway as well and I couldn't return the favor. If that is the case, then you are indeed in trouble, but fear not and... surrender, it is not a game over. You will probably be humiliated, you might loose a planet or two (i.e. all holy words and tomb words). If this empire is Fallen it won't rebuilt it's fleet and you will be able to strike back in the future. If it is awoken...then it is bit more problematic: you will became signatory, but fear not - they will start gathering "Decadence" debuff, that will cripple their economy and let you fight for your independence in the future.
Also, I'd suggest updating to 2.1 (or even 2.1.1 beta).