Yehudah's emergence as the leader during the wanderings in the wilderness essentially fulfills the blessing Yaakov gave him: “Yehudah, all your brothers will acknowledge you. Your hand will always point toward the back of your enemy's neck (the enemy will flee). All your father's children will bow to you (meaning that you will reign). You are a little lion cub, Yehudah.” (A lion and Peretz have the same qualities; a person who is compared to a lion has many passions and desires. They burst out of him and run away, while he tries to catch them, hold them back, and rein them in.) Yehudah, and later David, thus represent baalei teshuvah. There is nothing to be done about this. Their passions will inevitably burst out, wrong actions will be committed, and only afterward, after the fact, will they have to make amends for what they have done.
Incidentally, all of Rachel's descendants represent tzaddikim (the righteous), while Leah's descendants represent baalei teshuvah.
Yehudah's descendants never become kings suddenly. Their ascent to kingship happens very, very gradually. First comes a little lion cub, then a young lion, and only then a huge and fearsome Lion. But once he becomes a Lion, Yehudah acquires such strength and authority that he can lie down without fearing anyone's attempts to challenge him. No one would dare! The same is true of David. His ascent to the royal throne is a slow process. At first, even after he has been anointed king, he is still, in a sense, not yet a king. Much time must pass, and David will have to endure much suffering before he becomes the king who, like a lion, can lie down without fearing anyone, while his subjects and enemies alike tremble before him in fear.
The same applies to the coming of Mashiach—it is unlikely to happen suddenly. If events follow the usual pattern for the tribe of Yehudah, his accession to the throne will be a slow process and will have to involve several stages rather than just one. This is Maimonides' view.
Members of the tribe of Yehudah are usually the ones who build the Temple. Bezalel, from the tribe of Yehudah, builds the Mishkan in the wilderness. Solomon, David's son, builds the First Temple, while David prepares everything needed for its construction. Zerubbabel builds the Second Temple. He, too, is a descendant of the tribe of Yehudah. And the Third Temple will be built under Mashiach, who is known to be a descendant of David.
In the Tanakh, the Temple is called “Ariel”—a lion. Viewed from above, it resembles a reclining lion, the king of all beasts.