This is my personal view ,
- Quran , mostly has tales of Prophets and Messengers , their is mention of miracles and heavenly matter, end of days (judgement day etc)
Muslims of early times , who lived with Prophet had questions about many thing
related to daily lives, and they also were curious about End of times
They asked the prophet for advice how to do their day to day activities
prayers , trade, dealing with family , marriage etc
The early Muslim feared hell fire and they asked Prophet daily how to avoid it
Out of those interaction with Prophet , additional details were captured which were recorded and attributed to Prophet Mohammad. Great effort went in place to confirm , if anything stated was heard / recorded by multiple people
The interactions were captured , so that future generations if they have similar questions they can always refer to the incident in Prophet's time
If you want to understand the day to day live of early Muslims , you can extract a lot of information from reading the hadith books
These are modern age time machines
The hadith book are kinda like a reference book , reference book for every day issues and questions
* I noticed the Mahdi's discussion normally pops up in relation to
End of time discussions or as signs , people asked about End of time (Qiyamat) all the time and asked the prophet regularly so they would avoid it
The major signs were given to muslims in hadith , because people asked so many questions from Prophet about End of times
Reference:
Topic (End of time) :
Surah Qariya
https://quran.com/101
Surah Azzalsalah
https://quran.com/99
Surah Al Qiyama
https://quran.com/75
Yajoj and Majoj (Gog/Magog)
https://quran.com/21 (verse 96)
Blowing of Horn / Trumpet by Angels (Surah Naziat)
https://quran.com/79/1-11 (verse 6)
Talking beast of earth , day of judgement signs
https://quran.com/27 Surah Namal(verse 82)
Sun rising from West
https://quran.com/2/258 Surah Al Baqrah verse 258
Prophet Abraham/Ibrahim challenges a person that his lord will rises the run from east and will also from west refer to the translation
Prophet Essa (Jesus) arrival sign of hour
https://quran.com/43/61 Surah Az Zukhruf verse 61
Also mented in
https://quran.com/3 Surah Al Imran verse 55
The above qoutes are all from Quran and these same concepts are repeated in Hadith because people were interested to learn more about the final days
The same , signs (above) appear in verified hadith and those same hadith mention Mahdi / Dajjal