This is the kind of problem that requires you to define transactions that you will allow to occur, and what you then do is build an external transaction file that details the changes.
When I worked with the U.S. Navy, we had literally dozens of ORACLE-based and SQL Server-based databases that were located in different sub-nets. What we had to do was build an entire protocol of transactions that we could communicate from point A to point B. FURTHER, we had to build the protocol to include ACKNOWLEDGEMENT and REJECTION responses from B back to A. In fact, either side could accept or reject the other's sides transactions if there was a failure in the cross-checking done to verify that our transactions were properly aligned.
The main machine for which I was the primary systems administrator talked to not less than eighteen different systems. In EVERY case, they sent us transactions and we sent back responses plus our own transactions. Which usually meant that we transmitted text-record files that described what had changed. This was a military system so I can't tell you what the actual transactions contained, but I can synthesize an example.
On a given day, we might send records that LOOKED LIKE
#1, 12152017, "Action=Personnel", "SSN=314152653", "Name=Peter Piper", "Event=Enlisted", "Unit=12345", etc. etc.
#2, 12152017, "Action=Personnel", "SSN=141421486", "Name=David Twomey", "Event=Discharge", "Unit=98765", "Type=Honorable", etc. etc.
#3, 12152017, "Action=Personnel", "SSN=333333333", "Name=Mike Smith III", "Event=Promotion", "Unit=45432", "Rate=E6", "Designation=YNC", etc. etc.
#4, 12152017, "Action=Accept", "Record Number=3", "Record Date=12142017"
#5, 12152017, "Action=Reject", "Record Number=5", "Record Date=12142017", "Cause=No Such Member"
etc. etc.
In the above, #1-3 are new records; #4 and 5 show disposition of previous records.
And the numbering of records was important, since you had to know if a transaction failed and that meant storing the pending transactions that had been sent until such time as an acceptance or rejection came back.
In essence, when dealing with non-linked databases this way, you need to build a protocol of how you want to pass information back and forth between the databases and that means a MASSIVE design phase for what your databases can tell each other.
If there is ANY WAY to legitimately have a shared backend between the two databases, it might be cheaper than the design, testing, and implementation of such a complex thing as a formal data-exchange protocol. And before you say, "I don't need anything that complex" - trust me, the day will come that you have to resolve a dissonance between the two databases and without good transaction records, you will NEVER get it straight.