I have been reading about the tradition about appearence of Mahdi and what i have noticed is a pattern, that is no mention of Mahdi in earliest Hadith books, follwed by mention of a ruler without attributing the title "Mahdi" in Muslim and Bukhari who will appear at end of times and fill the earth with justice.
Ths is followed by later Hadith books which mention the name "Mahdi" and give more explanations about his appearence and describe him meeting Jesus a.s.
Muwatta Imam Malik the first of famous Hadith books mentions nothing about Mahdi. Imam Malik's born in 93 hijri and died in 179 hijry, i don't know when he authored Muwatta, probably around 150 hijry.
Bukhari and Muslim if i am correct written around 300 hijry and do not mention anyone with name "Mahdi". Then come later Hadith books like Tirmidhi and Abi Dawood which mention "Mahdi" and more details of his appearence such as he will be in Makkah and when people pay allegiance to him.
It gives an impression that concept of "Mahdi" evolved with passage of time.
Also notable is that Ibn Khaldoun a respected historian and social scientist doubted appearence of Mahdi and has written a critique of Ahadith about Mahdi and so did Allama Iqbal.
Ibn Khaldoun and Allama Iqbal both weren't traditional scholars and their doubts have been refuted by different scholars.