If they'd have been of similar speeds, perhaps. But Ralts had priority due to the Trick Room which means she attacked first. As a result, Meditite performed her move after Ralts had made hers, and that move was Thunder Wave. had they been of a similar speed, Meditite may have started to use Magic Coat in anticipation before Ralts was fast enough to use Thunder Wave, prompting the change of attack. I hope that makes sense.