As discussed here, wasting seed is not forbidden for a non-Jew.
Rashi to Bereishis 38:7 and Semak negative commandment 292 explain that Er and Onan died for that very sin.
If non-Jews are allowed to waste seed, why were they punished?
Mi Yodeya is a question and answer site for those who base their lives on Jewish law and tradition and anyone interested in learning more. It only takes a minute to sign up.Sign up to join this community
First, "not prohibited" and "allowed" are not the same. This is similar to what Rambam distinguishes in Hilchot Shabbos - פתור vs מותר. The idea of "פטור - not prohibited" means there's no earthly punishment, but the deed is unwanted and therefore somehow accounted for/punished, whereas "מותר - allowed" means the deed has no bad consequences whatsoever and apriori.
Wasting seed is not מותר for non-Jews but פטור בדיני אדם and חייב בדיני שמיים. Therefore G-d has the right to punish for the misdeed.
Your [commonsense] assumption that G-d only "kills for punishment" is disputable. G-d's could have them killed ONLY to allow Tamar to unite with Yehuda.
As simple as that. Now you ask about the interpretors? It's just an אסמכתא as they couldn't find any other mentioning of W"S in the Torah.