God was a hypocrite?!

I reject dogmatic religion because it often causes people to tell lies and be hypocritical to justify their irrational and unfounded beliefs. In a blog entry written more than a decade ago, I found a clear example of a conflict between the laws of Judaism and one of the fundamental teachings of the Christian faith, which is descended from Judaism:

The ultimate conflict between Judaism and Christianity

That was bad. Now I find, however, that there is a fundamental conflict even within the Jewish Scriptures.
Here’s a reminder of that Jewish law from Moses:
The fathers shall not be put to death for the children, neither shall the children be put to death for the fathers: every man shall be put to death for his own sin. – Deuteronomy 24:16

But then God told a completely different thing to King David:
2 Samuel 12:13-16, 18
{{{And David said to Nathan, ‘I have sinned against Yahweh!’

Nathan replied, ‘Yahweh has forgiven your sin. You shall not die. But because you have treated Yahweh with contempt, the child born to you shall die.’ And Nathan went home.

Yahweh struck the child that Uriah’s wife had borne to David….. A week later the child died.}}}

(Source: The Brick Testament.  http://www.bricktestament.com/king_david/ )

Wow! Do Jews and Christians ever read stories like this and not think about how horrible they are?! Or why God does not follow his own laws?!