Dynamics of Concept Learning and Compositional Generalization