Very interesting Theory of the Messiah,i would bet that early hadith Authors of Imam mahdi and Jesus return were familiar with the two messiah Theory.
The Two-Messiah Theory
When one studies rabbinic views of the Messiah one finds something very interesting. Many ancient rabbis spoke of two Messiahs, one who was the "Son of David" and another who was the "Son of Joseph." Though one can find the sufferings of Messiah attributed to the sufferings of the Davidic Messiah in many rabbinic writings, often a second Messiah is posited, the "Son of Joseph" or "Son of Ephraim," who is the one who suffers while the Davidic Messiah conquers. The rabbis struggled with Biblical portraits of a suffering Messiah, as found in Isaiah 53 and other places, and portraits of a conquering Messiah, also found in the Hebrew Bible. They posited two Messiahs, but could it not also be reasonable to believe there is just one Messiah but two aspects of his mission, a suffering aspect and a conquering aspect?
The eminent scholar Raphael Patai, who "taught Hebrew at the Hebrew University of Jerusalem" and served as Professor of Anthropology at Dropsie University,1said this of the two-messiah theory:
"When the death of the Messiah became an established tenet in Talmudic times, this was felt to be irreconcilable with the belief in the Messiah as Redeemer who would usher in the blissful millennium of the Messianic Age. The dilemma was solved by splitting the person of the Messiah in two: one of them, called Messiah ben Joseph, was to raise the armies of Israel against their enemies, and, after many victories and miracles, would fall victim Gog and Magog. The other, Messiah ben David, will come after him (in some legends will bring him back to life, which psychologically hints at the identity of the two), and will lead Israel to the ultimate victory, the triumph, and the Messianic era of bliss."2
There is only one Messiah, but there are two comings and two aspects of his ministry. The Messiah came the first time to provide atonement for sin. He is now expanding his kingdom and conquering the Gentiles, not by the sword, but by preaching. (In this century alone over 50,000,000 Chinese have come to faith in the God of Israel through Jesus, even while being persecuted.) Messiah’s Kingdom is growing tremendously among the Koreans and in Africa and South America. Many earthly rulers bow down before Messiah Jesus. One day he will return to judge the earth and to bring in his Kingdom in all its fullness. Know him now as your sin-bearer and bow before him today as your King, and when he returns you will not need to fear the judgement, because he came to receive the judgement in the place of those who trust him.
1. Patai, Raphael, The Messiah Texts, Avon Books, © 1979, p. vii