Before anything else, let me extend my kudos to the commenter who rightly pointed out that there was one other Yaakov Avinu grandson - Beriah ben Asher - who managed to procreate before the clan descended to Egypt. I humbly submit to a lack of vigilance on my part.
Now, to review the main issue, virtually all chronologists agree that Ehr and Onan were relatively young at the time of their early departures from this world. It is questionable if they even reached the age of Bar -Mitzvah. As such, how do we reconcile this to an "established" protocol that asserts that people are not liable for Heavenly retribution below the age of 20?
I did mention in the post that I had an answer which I considered to be a bit "feeble". I will present that approach shortly and a second, less feeble approach, that is a variation to it, but I wish to add that over Shabbos, I was inspired to a third, more profound approach.
The first approach was inspired by the words of a Midrash Tanchuma in Parshat VaYigash 9 which states as follows:
אמר ליה הקדוש ברוך הוא ליהודה אין לך בנים עד עכשיו ואין אתה יודע צער בנים אתה טגנת את אביך והטעית אותו בטרף טרף יוסף חייך תשא אשה ותקבור את בניך ותדע צער בנים מה כתיב אחריו ויהי בעת ההיא וירד יהודה מאת אחיו
HKBH said to Yehuda, "You do not yet have sons and you do not know the distress of [caring for] children. You have scorched your father and deceived him to think that 'Yosef was torn to bits'. Upon your life, you will marry a woman and bury your sons and you will know the distress of children."
What does it say subsequently? And it was at that time, and Yehuda descended...
We have all seen tragic incidents of young children being taken away. When it happens, we must console ourselves (or admonish ourselves) that they did not die for their own sins but for the sins of their parents. Indeed, the gemara states (Shabbos 32b) that "for the sins of [unkept] vows, young children die." It is reasonable to assume that other sins may also carry such a heavy price. Thus, we can posit that even though the Torah blames the two boys for their unnatural ways, this by itself would not have resulted in their deaths at such an early age if not that there was a decree upon Yehuda to bury his sons.
With this approach we are saying that the sins of Ehr and Onan were merely used by the Torah as a pretense to "justify" their early deaths whereas the true cause was the callous behavior of their father, Yehuda.
A variation of this approach may be that they were indeed killed due to their own sins. There is another reason why "Heaven" takes small children before their times. It is because כלפי שמיא גליא - it is foreseen in Heaven - that now that they have succumbed to the temptations of sin, they will not be able to stop and rectify their errant ways and will deteriorate into even worse sins, thus losing their portion in Olam HaBa. Thus, there is a concept of ימות זכאי ואל ימות חייב - let them die innocent and not die guilty - to preserve their share in the Afterlife. This is the concept of the בן סורר ומורה . This does not negate the protocol of not being punished younger than age 20 because, in this light, the Heavenly death penalty was not meted out as a punishment. It was actually an act of mercy from HKBH.
With these 2 approaches it makes sense to say that Ehr and Onan suffered "childs' deaths" and were particularly young - 8, 9, or 10 - and not yet Bar Mitzvah as many chronologists maintain. I considered the first of these to be a bit feeble because it asserts that they were not put to death for the sins that are alluded to in the Torah and it deviates from the simple reading of the pasuk. The second approach is much more in line with the story of the Torah.
It is interesting to note that the Seder HaDoros, one of the foremost Torah and Talmud chronologists, also incorporates the Kabalistic teachings of gilgulim - reincarnations - in his work. He writes that the neshamos of Ehr and Onan were actually reincarnated as Peretz and Zerach. Ehr was supposed to be the progenitor of the House of Dovid but was not worthy because his mother was a Kanaanite and not from the House of Shem. It was this Kanaanite temperament that brought about their sinful practices. Thus, G-d, in His mercy, put them to death and "recycled" them into the righteous Peretz and Zerach to launch the Malchus Beis Dovid.
With the first 2 approaches, we are understanding the protocol of the 20-year immunity rule in its simple sense and are speculating that the rule does not apply in all cases. In a case where the sins of the parents are taken in to account or where the child is deemed to be in an irreversible tailspin, the rule is overridden.
A third approach - and the one I want to promote - is that perhaps, we do not fully understand what it is that we are immune from. Let us consider the well known gemara in Sanhedrin 37b that says:
Since the destruction of the Bais HaMikdash, even though judicial death was abolished, the judicial protocol for judicial death was not abolished. Hence, one who would be liable for stoning will either fall from atop a building or be trampled. One who would be liable for burning will be trapped in a fire or bitten by a serpent...I would assume that the Heavenly forms of the judicial deaths would be enacted in the identical circumstances in which the physical judicial deaths are enacted. We know that if a 15 year old person were to commit a capital crime - e.g., murder - with full sanity and intent in the presence of kosher witnesses, he is liable for the death penalty under Halachic judicial law even though he is only 15 years old. Isn't this passage in gemara telling us that if the 15 year old commits the exact same crime with the same sanity and intent when the judiciary is no longer in effect, he can be liable for the Heavenly judicial death as he would have when the courts were active? Does it make sense to say that since he is not yet 20, he is off the hook when he wouldn't be in a human court of law?
To answer this question we say that there are two forms of judgement. There is "Human" judgement and "heavenly" judgement. This is implied when we use the term "din v'cheshbon" as in the Mishna in Pirkei Avos 3:1 and 4:22. The commentaries tell us that "din" refers to the judgement for the act that was committed - judgement netto. "Cheshbon" refers to an accounting of everything that was affected by the act - judgement bruto or, meta-judgement. A mature person is responsible both for the "din" and for the "cheshbon".
For example, if somebody sexually abuses a young person and, as a result, the young person rebels against Judaism and goes OTD and does countless transgressions. Also, he never marries and brings up a Jewish family. Also, he abuses and corrupts others and sets off a continuous chain of abuse and corruption. At the level of "din" the initial perpetrator is responsible merely for the sinful act. But at the level of "cheshbon" he may be responsible for much more. He may be responsible for all of the victim's personal transgressions. He may be responsible for the travails of the nice frum woman who was destined to be the victim's wife but now is embroiled in the "Shidduch crisis". He may be responsible for the unborn children of the marriage he should have had. He may be responsible for all of the other victims through the chain.
This is something that only HKBH can calculate. This is meta-judgement.
Likewise, if somebody bilks masses of people out of, say, 50 billion dollars. At a simple level - "din" - he is merely responsible to restore the $50B. Not a big deal. Yet, at the "cheshbon" level, he is liable for everything that that money could have accomplished if it were available. Sick people who will not get the proper medical care because the hospital lost money and suffered budget constraints or the charity that would fund his treatments folds up. People who will not be able to afford the education that could have enhanced their lives. People whose shalom bayis will be destroyed by a sudden loss of captal, etc.
I don't want to think about it.
So, perhaps we can say that this that a person is immune from "Heavenly" punishment until the age of 20 does not apply to the simple punishment of "din" for a sinful act that he does. In other words, it doesn't apply to a judgement that he would be liable for in a Halachic court here in this world. This is not "Heavenly" judgement even if it is delivered by Heaven. Here, Heaven is merely doing the work of the defunct Bais Din shel Matta. It only applies to the meta-judgement that only Heaven can do.
With this approach, we can go like the Ibn Ezra that Ehr and Onan actually reached the age of Bar Mitzvah - if just barely. The punishment of "Heavenly death" even though it is not in our hands to execute, is actually categorized as a simple "din" level judgement. This kind of judgement can be enacted from the age of Bar Mitzvah just like all Halachic penalties - even if "Shamayim" delivers it. The 20 year rule only applies to the more complex meta-judgement. But Ehr and Onan, being young, were not subjected to it. Thus they were reincarnated into Peretz and Zerach to have a clean slate.
I have not (yet) found support for this distinction in Torah writings, and, I must say that this does not seem to be indicated by the three Aggadic "sources" of the 20-year rule that I discussed in my first post (especially the one in Parshat Korach). Nevertheless, I believe this approach to be a sound one and for those of us free spirited young people - I truly recommend to "Ehr" on the side of caution.