And there's the rub. Whoever writes those law codes or rules is going to have biases. In the ancient world, you generally had monarchies or oligarchies making the rules so they favoured hereditary, land-holding upper classes. The Jewish laws likely developed over time from a number of sources, including the kings but mainly the priests of Yahweh. So different biases but hardly geared to a just, equitable system.
Short of a more equitable representative democracy (direct democracy has historically not done well in the "not disadvantaging to marginalized people" front given it tends to be majority rules) than I think any country on Earth has right now, a truly fair, just, equitable law code is going to be hard to achieve. So I agree but that's going to be a hell of a slog. We and some Western European countries have some successes, the US has, too, but no one is really there yet. And it often two steps forward and one step back at best.