To me its just plain sense, that if you call upon and follow God, the last thing you want is for your family to go and mingle with the decedents of Cain. Also we dont need the law to know what is right or wrong we already have it written into our conscience by God, its just that God allows those to sear their conscience so justify sin.
Rom 2:14 For when Gentiles, who do not have the law, by nature do what the law requires, they are a law to themselves, even though they do not have the law. 15 They show that the work of the law is written on their hearts, while their conscience also bears witness, and their conflicting thoughts accuse or even excuse them