Based on the Digivolution wiki, Agumon and Gabumon didn't quite perform a Mega Digivolution - they performed a Warp Digivolution.
Warp Digivolution is a digivolution process where a Digimon can reach a higher level directly bypassing any intermediate phases
When Tai and Matt were shot with the Angelic Arrows, Agumon and Gabumon wrap digivolved to their Mega forms. During the digivolvution scene, they say
Agumon/Gabumon warp digivolve to WarGreymon/MetalGarurumon
Furthermore, Warp Digivolution and Mega Digivolution are not the same thing. While see Mega forms in season 1, regular Mega Digivolution is actually not seen in Season 2
Mega Digivolution is a Digivolution method that allows an Ultimate Digimon to digivolve to Mega. It is initially used by Paildramon to digivolve to Imperialdramon in Digimon Adventure 02.
In the episode Determination, the digidestined were also shocked to see the fact that Gomamon was able to achieve his Mega Digivolve of Vikemon.
Joe realizes that his relationship with Gomamon is the more important thing, and so he charges back to the battle. This rebirth of confidence allows Gomamon to achieve his Mega level, Vikemon, much to everyone's surprise
Explained in Season 2 a strong bond between two individuals is required to perform DNA Digivolve, and it is possible such bond is able to achieve Mega Digivolution.
Seeing Joe's resolve, Mimi regains faith in herself as well and helps Togemon her own Mega level in Rosemon.
As we see in the following episodes, there is a continuation of strong, emotional connections between the digimon and digidestined.
Confession
Izzy pleads with Tentomon to enter the shield, but Tentomon refuses to do so while his friends are suffering. He digivolves to his Mega form, HerculesKabuterimon
Loss
Sora risks her life to protect Biyomon from Machinedramon, digivolving her into her Mega form, Phoenixmon