I think you will agree the bible makes it clear that the world was absolutely moral at the start until the human decision to alienate itself from absolute morality.
The world is therefore fallen and God then works with humanity as it is. The Old testament then forms an account of the development of a nation who have a certain revelation of God
which God wants to preserve. God navigates the isrealites through ancient peace and warfare.
Why then should the jewish religion be so imperfectly preserved in the world where everything is tainted and there is no effective absolute morality? The answer is that it is a vehicle for the eventual saviour of individuals of any and every nation Jesus Christ.
I think your mistake is not recognising the fallen imperfect state of the world where absolute morality is not exercised