Thermodynamic Isomorphism of Transformers: A Lagrangian Approach to Attention Dynamics