I am not an ABAPer, however - logically this is what we can do/
If you are doing it programmatically then perhaps you should write a list on systems and mark one of them as master. This list can be kept as a flat file and then supplied as a variant or can be hardcoded in the code itself. Or simply hard code the master system name. Then you can always redirect the request from child system to master as there will be only one check, - "If master then else"
If you have multiple master, then you can prepare a flow chart 1st on how you want to determine child and the task you need to perform. Once you have the algorithm ready, we can substitute that with actual code.
If I took query incorrectly, please apprise me for the same.
Regards,