A High Priest shall arise from Levi and a King from Judah who shall save the Nations and Israel. -Simeon #twelvepatriarchs #yeshua
The idea of Messiah ben Yosef and Messiah ben David might date to later than the New Testament, but it is probably rooted in a much older idea of a Messiah ben Aharon and a Messiah ben David, reflected here in The Testament of the Twelve Patriarchs and in the discussions of Messiah's priesthood in the Epistle to the Hebrews.
Maybe the ancient Jews believed there would be two Messiahs and maybe not, but I suspect that the original idea was extrapolated from multiple Biblical sources: the prophetic types of Judah and Joseph, the governmental structure of Israel mandated by God with authority mostly divided between Levi and Judah, and the apparent contradictions in prophecy concerning a suffering servant and a conquering king.