My guess would be that wormhole entrances/exits are sector-level objects and the workhole itself is a galactic entity. In theory there might be a collection containing all the wormholes in the galaxy that one could iterate through to discover any with exit/entrance coords that match up with a central-galactic range. I'm just fishing out ideas here though.
You might look at the mod which allows players/admins to add their own wormholes to see if you can reverse engineer that. If an admin is adding wormholes, then surely it's registering them with some collection somewhere.
I do remember that wormholes are generated at the sector level, which might mean one would have to iterate through all of the sector data looking for wormholes and then, hopefuly, that entry would contain the data for it's matching wormhole in the target sector.
Bleh... now I'm curious and have to go digging though the code.