From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformers