This problem could be solved by the 'seat of government' feature we've discussed before. If you have a special ability that can be put in a facility OR on a component called 'seat of government' you could then determine diplomatic relations by the existence of said component or facility. If you lose it, your diplomatic relations go out thew window until you can make a replacement. If you're really paranoid like the Minbari in B5 you could keep your seat of government in a cloaked ship off in a remote corner of your empire.
