But is not a direct retelling of any of them, and is written for a game setting which had rules about moral alignment.
It is very close to a retelling.
And the rules about moral alignment are like the rules about swords and armours: they are meant to relate to, and in some sense be proxies for, things that exist outside of and prior to the game. They are not their own self-referential moral reality.
At the time DL was published the definitive treatment of alignment was in Gygax's AD&D, and in those books he locates all major moral theories - moral virtues (like honesty and compassion), other valuable things (like truth and beauty), Benthamism (the greatest good of the greatest number) and liberalism (human rights) - within the domain of
good, and conversely defines
evil as the contrary of these, that is, as the refusal to recognise any values or other-regard as a restraint on permissible action, and the scorning of compassion, beauty, truth etc.
So when we read DL's discussion of good gods, evil gods, a "balance", etc, it is not arbitrary and self-referential. Like the stuff in Gygax's rulebooks, it is obviously meant to be understood in terms of moral ideas and traditions that sit outside the game, and that the game draws on for its particular purposes.