I mean, I haven't gotten to the Delta Episode yet so this might not work, but maybe we just write off the trading compatibility as a meta concept, and assume that Hoenn and Kalos are the only regions with mega evolution and are very secretive about it (the other regions don't know it exists).
Or Zinnia's right and there'[s a parallel universe in which megas exist but things in both universes still occur in basically the same order. Perhaps the universes branch until XY, which could exist in both and introduce megas into the non-mega timeline.
So like FRLG/RSE>HGSS/DPPT>BW>BW2/XY as the non-mega timeline
and megaGen1/ORAS>megaGen2/4>megaGen5>XY as the mega timeline