1 john 3:4 says. "...sin is the transgression of the law..."
Romans 6:23 says, "...the wages of sin is death..."
God's law stated that eveery male child would be circumsised on the eigth day after their birth, but Moses refused to do this for his son.
God is no respecter of persons and whosoever committeth sin...shall surely die. God was being true to His word.
It matters not how we have lived our lives in the past or what we are doing at the time. When w commit sin, we are worthy of death.
The covenant God made with us is that when we confess our sins according to 1 john 1:9, then He is faithful and just to forgive us of our sin because of the sacrifice of Christ.
Because of the act of Moses' wife, in obedience to God, He repented of His anger and did not kill Moses.