Some EHRs are pretty good about this nowadays. Epic, for example, allows you to share info across health systems. The user has to enable it though, which is a problem due to low adoption among older patients.
Also, this will be less of a problem in coming years due to increasing consolidation of health systems.
I can’t speak to much of this, but I have a friend who works on the technical side of health insurance. Specifically he is helping with FHIR. I did some HL7 work a long time ago which lets health systems talk to each other. FHIR is supposed to be a more comprehensive offshoot (I asked if it was HL7 on steroids and wasn’t corrected).
Unfortunately, I may have misunderstood. My career took me a different path than his so I’m way out of date on it.