The murderer knew that he could only marry again after the death of his wife. So he decided to kill her, in order to be free for a second marriage. His theology was correct, but his conclusion lacked a little. Paul has both the right theology and the correct conclusion.
So, my brothers and sisters, you also died to the law through the body of Christ, so that you could be joined to another, to the one who was raised from the dead, to bear fruit to God.
Romans 7:4 NET
To live for the law means to prove one's own goodness by its perfect observance. Impossible to do. The result of that is that the law has only the power to accuse and condemn.
When we died to the law, we became free from this impossible project. Paul uses the figure of marriage (verses 1-3), in which death separates the spouses. By our death to the law, we are freed from it and are joined to another, Christ, who brings the forgiveness and holiness necessary for the presence of God. And it produces fruit for God, our sanctification.
This liberty from law and belonging to "another," Jesus Christ, through his body (crucified and resurrected), makes this death wonderful, for it brings us into the presence of God.