The Parsha Experiment

Is this a chapter in Genesis or an episode of Game of Thrones?! In Parshat Vayeshev (Genesis 37:1–40:23) the story of Joseph's drama with his brothers is put on hold for us to learn about Judah and Tamar's seemingly scandalous rendezvous. Why are we hearing about this story now? What does it mean and what can it possibly add to our understanding of the Joseph story?
For more on Judah and Tamar: The ‘Scandalous’ Backstory of Boaz and Ruth