These debates always trigger a much deeper dig for me...and I looked into Judah and I'm struck once again that the kinds of people God uses for His purposes. Certainly, He didn't use the perfect, and that is more to His glory.
I once heard a saying, "The footsteps your children will follow are the ones you thought you covered up..."
Judah was not the first son, he was the fourth son of both Jacob and Leah (the unfavored wife).
Maybe to understand Judah and "the trouble" with Tamar (I doubt that when God took an entire chapter to tell Tamar's story, all He had in mind was contraception), you have to go back to Judah's grandfather, Laben.
Remember, Jacob was all about avoidance (of Esau), when he fled to Haran. He and his mother conspired to lie to Isaac, in order to have Jacob sent to Haran. There, he found Rachel and asked for her hand.
A fine example for his grandson, Judah (who would later send Tamar away with the promise of his third son) - Laben promised Rachel to Jacob - and then secretly gave him Leah instead. jacob worked longer in order to have Rachel as well, which set the family up for even more problems.
Jacob loved one wife more than the other and the wives ended up detesting each other - their marriage was less about love and more about a son-bearing contest, even to the counting of giving their personal hand-maidens to Jacob, in order to rack up more "son" points. Even so, Jacob was loved by God.
Later, when Leah's daughter, Dinah was raped by a young man who was very taken with her, the young man's father was prepared to do the "right thing" and marry the two. Two brothers (neither of them Judah) lied. They said they couldn't do it - unless all of the males in that city were circumcised. They agreed, had the "procedure" and when they were recovering, Jacob's two sons killed them all and plundered the city.
So we're finding that the sons of Jacob didn't seem to be the "good guys"
Even the sons of the different mothers hated each other. Jacob already had a bunch of sons before Joseph was born. The older sons knew that Jacob played favorites, and they hated the favorite.
When the brothers decided to kill Joseph, Judah was the one that talked them into selling him into slavery instead.
[Reformed theology note: this is a place where I can see man's sinful choices working with God's sovereign plan. If God's plan to put Joseph in Egypt were to succeed, was it possible for the brothers to have killed Joseph, instead of selling him? Was Judah acting out of concern for Joseph, or in the will of a Sovereign God?]
Then, they all conspired to lie to their father (kind of what goes around, comes around...)
At some point after that (the Bible isn't clear on timing) Judah "went down from"his brothers and married an unnamed woman (the daughter of Shua), but we do know that she had three sons, Er, Onan and Shelah.
I once heard a saying, "The footsteps your children will follow are the ones you thought you covered up."
I don't know if these guys even tried to cover these footsteps, but Jacob got what he was in Judah; Judah got what he was in Er and Onan.
When Er married Tamar, God killed him because of his wickedness. So, on to the next brother...Onan. We all know what happened there (although the Bible doesn't say exactly why, other than Onan did a wicked thing). One thing is sure, Er didn't have an heir.
So, Judah (doing what that family seemed to have done best) - lied. Again.
Judah sent Tamar off to her father's house as a widow, with the promise of his next son - a promise that he never intended to keep. This would hint that Judah still had legal control over Tamar, else her father could have married her to another man.
As it was, Tamar sat at her father's house, in limbo, knowing that the youngest son, Shelah, was all grown up. She took matters into her own hand, dressed up like a whore and Jacob solicited her (not the other way around).
She had to trick Judah into being her "kinsman-redeemer", fulfilling the family obligation.
I am struck at how God's purposes are fulfilled by the basest of men. If God can use these people, He will, perhaps, be able to use me.
We've read about Judah and all of his trickery, but he was also the father of the kingdom of Judah; Christ is the "Lion of Judah".
Judah's sons never made it into the genealogy of Jesus - but Tamar and Judah did.
Later on, Judah's another kinsman-redeemer didn't have to be tricked - Boaz, who married Ruth - great-grandparents of King David.
Maybe, just maybe - the moral of the story is that - no matter how bad we are, no matter what our family history is, no matter what influences we've had to deal with - God can use us.