Yosef played the messianic role consistently through his life. God is the one in control of Yosef’s life, not Yehudah. Yeshua the Mashiakh wasn’t even born, yet we read all about Him in Yosef’s life. When Yeshua told the elders that all of the Scripture is a testimony of Him, this is just one of the stories Yeshua is referencing in his rebuke of the willfully unbelieving Pharisees.
This isn’t a Bible passage one might want to read to young children, but it is recorded for a profound reason. It gives us another insight into the character of Yehudah (Judah), and the symbols point to King David and the Messiah.
This chapter about a scandalous encounter between Yehudah (Judah) and his daughter-in-law Tamar seems out of place in the account of Yosef’s slavery in Mitsraim (Egypt). Yet the twins in this chapter — Perets (Perez) and Zerah — share a link to Messiah with Yosef (Joseph).