After Judah repented he was sent to Egypt to prepare the way for a Yeshiva- a place to study Torah.
His repentance set in motion the line of descendants that would bring into the world David.
From the seed of David, Yeshua would be born. Yeshua the Jewish Messiah was sent from G-d to be our saviour first and then He would become the saviour for the rest of the world. And thus, the Kingdom of Heaven was established by Yeshua and now we await HIS return.
This was G-d’s plan all along.
In advance of his arrival in Egypt, Jacob sent Judah to prepare a yeshiva – a place where he and his descendants could devote themselves to constant study of the Torah.
[Jacob] sent Judah ahead of him to Joseph, to make advance preparations in Goshen. Genesis 46:28
Jacob sent Judah to start a school rather than asking Joseph to do so, recognizing that a Torah academy must be headed by a person who is completely removed from mundane affairs and is fully immersed in the study of the Torah. Since Joseph’s Divine mission required that he run the mundane affairs of Egypt, he could not also head Jacob’s school of Torah, notwithstanding his undisputed righteousness.
Likewise, those who wish to adopt the vocation of the Torah scholar or teacher must be both allowed and required to be completely separated from worldly affairs, in order to be able to focus on educating our children without any distractions.1 Likutei Sichot, vol. 3, pp. 827–830. See Eiruvin 65a.