There really isn't a understandable and specific reason for this happening. All of your answers lie in the code of the game and with the data that was affected when you stopped the trade.
The most likely reason for the buggy Groudon is that it was cloned improperly; you didn't perform the glitch correctly. I can't really go into specifics since I'm not a programmer, but the timing must be very precise for things to run smoothly as the game sends the Pokemon's data to the recipient, as Bulbapedia mentioned:
>Most Pokémon will clone at about three seconds, although it has been observed that some held items impact the time taken to clone.
Since the game received what was essentially glitched Groudon, strange occurrences like these shouldn't come as a surprise. This is probably why Groudon appeared as Skarmory and explains why the real Groudon disappeared. The level 13 Flabebe surviving the Earthquake is most likely a bug with Groudon's Attack stat (again, because it is glitched), or a bug with the game that caused it to calculate the damage improperly, which would also explain why it was super effective. Of course, it could have been a bug with the Flabebe, but I find it easier to believe that the problem was with the Groudon.
Again, it is impossible to give you a specific and definite reason, but what we do know is:
- It was definitely caused by you attempting to clone Groudon.
- You didn't perform the glitch properly.
- The cloned Groudon was a glitch Pokemon (explains why it disappeared).
Try going back to your game and checking that it still runs normally. If it runs normally, it was probably just the Groudon or a temporary bug. If it is still glitchy, then clearly the Groudon or your attempt to clone it has damaged something in the game.