I was once alive apart from the law, but when the commandment came, sin came alive and I died.
Romans 7:9 ESV

Not as if sin didn’t exist before the written law, but condemnation requires a witness. A clearly expressed commandment becomes the teeth of sin. The first part of the verse is likely from the hypothetical perspective of a man who doesn’t know the commandments. Once he learns what God expects of him, his sin becomes apparent, and he realizes his state of spiritual death.