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
Because Tamar consented to these sexual acts and marriages for the sake of procreation. Rashi points out that Er wasted seed because he wanted to keep her beauty, but as we learn from her marrying Onan afterward, and waiting for his brother even after he died, she wanted a child. So for Er and Onan to waste seed, knowing she is only allowing this sexual act for the sake of that seed, means they are raping her. It's like the reverse of the rape scenario of a woman consenting to sexual relations with a condom, and the man removing the condom mid act. When Er and Onan began pulling out to deprive her of child they were violating her consent, and therefore, violating her.
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.