Cain and Abel are two sons of Adam and Eve. Cain, being a farmer, brought an offering of the fruit of the ground and Abel’s offering consisted of the firstborn of his flock and their fat. When the Lord only appreciated Abel’s offering, it infuriated Cain, and out of anger, Cain murders his own brother Abel in his field. In the result of Abel death, the Lord puts a curse on Cain, making him walk the earth as a fugitive and vagabond, while also ensuring that since he killed in brother on his filed, he will no longer be able to yield from the earth. Unable to bear the thought of living his whole life as a fugitive, Cain asks the lord to kill him. The lord, in addition to his curse, puts a mark on him saying whoever kills him will be revenged sevenfold.
Mythologically, God is seen as the almighty authoritative figure, who is trying to set right the wickedness his creations have caused. He sets the precedent that killing another human being will not go unpunished. And as time passes, the wickedness of man kept increasing to an extent that the Lord decided to destroy the entire mankind expect for a chosen few.
I agree with your analysis yeilding “killing another human will not go unpunished”. While we see the degree of the punishment for murder increase from Cain to his great grandson, we can draw closer to God’s flaw in designing humans. Why has God allowed humans to murder and sin, rather than being perfect and unflawed?