My headcanon for this is that Twilight learned from her previous encounter with the cockatrice and researched a spell to protect herself. Unfortunately, she couldn’t find a spell to counter the cockatrice’s gaze, but she did find a spell that can keep her conscious as a statue and able to cast limited magic spells, namely a tracking spell to alert Fluttershy or Zecora where she is. Now to wait…….