But how can they be righteous? They don't worship God, they don't obey his commands - they don't even know what his commands are - (except of course for Lot, who was an immigrant). Clearly, then, according to this narrative, one can be "righteous" other than by obeying God, and this premise is agreed to by both God and Abraham. So the Torah here directly contradicts the "Divine Command" theory of ethics.
You seem to be confused on at least one point: God has not only given us ethical instructions via the written text but has placed them within us—written in their hearts—as the Bible states and managed by our consciences.
Thus, even before the giving of the Ten Commandments to the Jews Gods ethos was infused within human kind.