1. Jesus was quoting Jewish (not necessarily Christian) Law and Practice
Jesus was referencing a Jewish custom called levirite marriage. In the Torah, at Deuteronomy 25:5-6, God specifically commands the Israelites to practice this custom, with the explicit purpose that the brother who shall have died should not "have his name blotted out." Put another way, he wanted to provide for the surviving widow and the family legacy.
Indeed, the story of Judah and Tamar even highlighted the crime that Judah committed against Tamar, leaving her destitute and childless when he withheld his third son from Tamar, after both Onan and Er died.
As both custom and Jewish law then, one can clearly establish it was Jewish, but then it raises the question To what extent does the Law of Moses apply?. There are cases to be made that the Torah (also called "the Covenant") does not apply because it was a specific contract between God and the Jews at a specific point in history. (This is called dispensationalism and is very common amongst many Christians.) There is also a counter case, but that is a rabbit trail, because there is a much greater issue with the question.
2. It is bad exegesis to assume every statement is prescriptive.
Even without the context, one would clearly have to misread the text in order to even ask the question.
Jesus was arguing with the Saducees (who deny the resurrection). The Saducees were the ones making an argument even they thought to be absurd here. For example, Pastafarians might well ask a Christian, "How do we know that God isn't a Flying Spaghetti Monster?" Let's pretend for a moment that a biblical writer observed Jesus responding to such a silly question. Would then legitimate the notion in the process? Of course not! Just because Jesus listened to someone who was wrong, it doesn't make what the person who was wrong somehow right!
The Sermon on the Mount records Jesus saying:
“You have heard that it was said to those of old, ‘You shall not murder; and whoever murders will be liable to judgment.’ 22 But I say to you that everyone who is angry with his brother[c] will be liable to judgment;
27 “You have heard that it was said, ‘You shall not commit adultery.’ 28 But I say to you that everyone who looks at a woman with lustful intent has already committed adultery with her in his heart.
In both of those cases, if one stops at the hypothetical, one misses precisely what Jesus was trying to say!
In general, there is a tendency amongst many new or non-believers to turn the Bible into a magic talisman. There is an old joke about someone opening the bible, looking for guidance, and reading:
"Judas went out and hung himself."
Then, the person decides, well, maybe that isn't directly applicable. So he tries again:
"Go and do thou likewise!"
I can take any work, misread obvious intent, ignore the genre, and then find it strange.
When I read the Song of Solomon, I see a woman and a man about to go have sex in a garden. Am I supposed to find a random woman and go have sex with her there?
- Psalm 137:9 says "Happy are they who dash their infants' heads against a rock!" Does that mean I should go kill babies?
Matthew 19:12 says that it is better for me to cut off a part of my body than for the whole thing to be cast into hell. If I struggle with sexual thoughts, does that mean I must castrate myself?
Obviously these are silly - no responsible Theologian, be she Christian or Atheist would assume that is responsible. There is a context, and to read without context does violence to the intent of the work.
3. The context is clear
The context is clear - Jesus' opponents bring out an obscure custom in an attempt to make Jesus look foolish. (Oh how times have changed, right?)
Jesus takes the question, listens to it, and corrects the assumption. If Jesus didn't listen, he wouldn't be kind. But how does that legitimize anything?
The Sadducees thought Jesus foolish for believing in a resurrection because woman "obviously" couldn't be married to seven men, even though that is what the Torah (which they did believe) could set up a situation where that would have been the logical result.
Jesus says - If you actually knew what heaven was like, you'd realize the absurdity of your own question.