I will now tell you what I think happened. It’s just headcanon, but I think it might be the most logical explanation, based on what the movie suggests and what’s come out so far.
The Unity Crystals were created because the pony magic had gotten out of control and had become a danger to everyone by becoming so emotionally unstable that the magic must be made neutral. Twilight, the element of Magi, along with her friends, also elements in direct connection with the Harmony tree, may have discovered that this could not be repaired without changing the very essence of the Ponykind. So “foci” of all the ponies - and possibly the rest of the world - had to gather into a single foci to “contain” the magic and make it controllable. The Unity Crystals replaced Harmony, and had become an important symbol as evidenced by the stained glass windows found in the airship station. It is possible that Twilight, long after the death of her friends, was still working on the Unity Crystals to find a solution and may have made discoveries.
Because I think all the “foci” points that all the ponies had to have magic could have extra dimensional gates like with Discord and his chaos magic as he had a dimension of his own. By gathering all of these into a “door”, Twilight may have found a direct entrance to the dimension from which all magic came. In my headcanon, the Mane 6 ascended after their death to the elsewhere. And if it is the elsewhere where Twilight becomes an alicorn, which is the magical dimension - it means that she would have rediscovered her friends. Perhaps it could make it possible to repair the magic that had obviously become unstable, perhaps as a result of the windigos’ attack. The windigos stole magic from the ponies by absorbing their negative emotional reactions and turning it into ice and cold. This is stopped with positive emotions. It could be how the neutral magic had become so emotionally unstable. With time it had only gotten worse as the magic seems to grow stronger.
All indications are that Twilight will outlive her friends, as she is not only an alicorn, but also a reigning princess/queen with her duty to the ponies. Meghan McCarthy in 2013 thought it won’t happen, but logic dictates that it will. And that is partly confirmed in the IDW comics, everything suggests that she ruled for at least 800 to 900 years - and that G5 happened 100 to 200 years after Equestria collapsed. There is no doubt that Discord misses his friends, especially Fluttershy, and his motives for taking magic away from the ponies suggested that he had grown accustomed to considering himself a friend of the Ponykind. He had probably lived a long time with Twilight and the other “immortals”, and this is not erased with amnesia.
My headcanon is that the elsewhere is the “retreat” for all heroes and special gifted ponies after their death as with the spirit world in the Kung Pu Panda world. If the Unity Crystals are the door to the elsewhere that perhaps only the alicorns can enter and leave, it means that the Mane 6 is not “dead”, just retired. This will then open up an angle about the enigmatic alicorns, not least why they are so powerful, why their instincts are to be the shepheeds for the ponies - and where they came from, whether the pony magic and the alicorn magic are one and the same. We only know that ponies that were “chosen” become alicorns - by the mysterious magic.
The mysterious alicorn who was likely the unicorn that forced the creation of the Unity Crystals is an enigma in itself, how could she ascend? There are many indications that she had confronted the other alicorns only to lose and flee, as the Unity Crystals ultimately chose Sunny and her message of friendship. I think she represents something from the ponies’ dark past that is uncharted, as Discord pointed out that she wanted a “perfect” Equestria.
But in the end something happened. All of middle Equestria disappeared. The valley, which contained the Everfree forest, Ponyville, the harmony tree with the ruins of the two sisters’ castles, Canterlot and Clouddale was abandoned and forgotten - as happened “recently”. The movie showed that the whole valley has been deserted, only the lower parts where Ponyville was located are still not seen. The harmony tree had become a normal tree. Then we learn that the ponies didn’t remember what happened, this has been shown repeatedly even though Sunny’s father seems to have salvaged surviving G4 books. It was then discovered that the ponies were not at war with each other when it came out that they did not know that they had all lost their magic. In MYM, it emerged that the pony magic had become uncontrolled and dangerous.
It was then discovered that Discord had been living in isolation in Canterlot which had been abandoned after what appeared to be an attack. Who had been exposed to traumatic experiences that make him erratic and likely forgetful, who only wanted to dwell on the good memories. He had lost a horn, and it may have happened when he was defending Canterlot so it could be evacuated.
From the movie there are many hints about what may have happened, not least the possibility that the ponies had been subjected to a memory erasure which is possible in the Ponyverse where there is magic that allows the manipulation of memories - or erasing them. It was then found that the magic had disappeared, but it seems to be more than just the ponies’ magic although this is uncertain. All magic had disappeared with the clear exception of the background magic that enables the use of hooves, the survival of chimeriac creatures and possibly the movements of the celestial elements. Someone had taken apart the Unity Crystals.
The prime candidate to be behind such an act is Twilight Sparkle, who was possibly the only one capable of separating what is one (besides Discord). But why? Even many centuries after the Mane 6 disappeared into the history books, Twilight will have Discord, Spike, dragons and possibly other alicorns as well as new friends and allies with her to face dangerous enemies. Twilight knew the price that had to be paid when she created the spell behind the Unity Crystals, and she knew that the loss of magic - and the risk of unstable magic in the event of a return - could not be justified. Still, she thought there was no other choice. She may have been forced to sacrifice Equestria and harm the Ponykind for the sake of survival.
From Canterlot it is clear that it was a festival that had turned into chaos and panic with internal unrest within and evidence of attack from without. This suggests a surprise attack that no one saw coming. My theory is that Discord was protecting Canterlot and possibly Ponyville to evacuate the citizens while Twilight tries to stop the disaster that may have been magical in nature. But from what the movie showed - it looked like a magical explosion that wiped out the Everfree forest had happened. A place with huge magical reservoirs from time immemorial, which the ponies had to keep in check since they came to the valley. Perhaps the beginning of the Disney movie “Atlantis” can show what happened.
Twilight, Discord, the Harmoni tree - nothing could stand against the attack which was probably not only aimed at the valley in Equestria, the whole world might have been affected. Powerful magic—perhaps evil magic—had come to Equus and is threatening to erupt. Then there is only one solution to stop the magical eruption that may have done damage in advance; to remove all active magic. So Twilight took apart the Unity Crystals and sent the three separate crystals away. Without magic, the attacker will be forced back, possibly out of Equus. But in the end, Twilight had to disappear, while Discord lives in isolation, possibly confused and grieving. The others will run away from the ponies out of fear of their unstable magic and under the belief that they were responsible for the loss of magic. Those who knew better, possibly Spike, didn’t dare do anything because Twilight might have gone missing. The world had fallen apart.
This is how the G5 world may have started. Grogar’s bell in the movie strongly suggests that the attacker may be the boss villain himself, who was stopped on the doorstep from invading Equus. And now the magic has returned, moreover it is possible that the many decades of fear may have strengthened him in the limbo in the meantime. So if what I’m speculating can be correct, that means that Sunny and the Mane 5 are in for a very hectic time for the rest of the G5. Because in the end they have to solve a big problem and end a very old conflict.