TAR: Teacher-Aligned Representations via Contrastive Learning for Quadrupedal Locomotion