Attention to Order: Transformers Discover Phase Transitions via Learnability