Bridging thermodynamics and metrology in nonequilibrium quantum thermometry