I don't think it's that much of a stretch to design a system that keeps, for instance, issue, wiki, and PR metadata in git alongside code. This could then support simple import/export between instances. You could also support cross-instance forking and PR's.
The biggest problems I think you would still have are 1. third-party integrations and 2. abuse/spam prevention. Having been the system-owner for GitHub at a large engineering org before, I can say that for us, switching away would have been virtually impossible because of all the integrations we would have to replace. But, this is a consequence of the centre of gravity being Github currently and not an immutable law of nature.
As for 2, well I expect that'll remain one of the hard unsolved problems of computer science for the time being.
You may want to re-read Poe's Law[0].
Poe's law technically refers to Sarcasm but tends to cover Facetious comments as well.