Perhaps it has something to do with breaking the 999 stat limit? In many games that feature numbers they have set some kind of limit in the game, which when broken can cause glitches. Either the numbers just reset back to 0 or they go to infinity.
It's clear that this was also a problem for the programmers of the RBY generation. As proven by the fact that they did
not allow any pokemon to raise their stats above 999 . Apparently the programmers managed to fix this problem in the later generations allowing pokemon to raise their stats above 999 without causing glitches.
Maybe they haven't thought of fixing this under Trick Room conditions? Perhaps once the ninjask reached 1068 Speed it got reset to 68, allowing it to outspeed Meloetta under Trick Room?
I know that this theory may sound a bit ridiculous but to be honest i cannot think of any other explanation.