One big difference between owning sloppy code and issuing a risky stock contract is that the stock contract comes due on a certain date, which is known in advance. Sloppy code is much harder to manage because we never know when we will be called to account for it. Like debt, code sticks with you until you pay it down or go bankrupt.
Maybe it's more accurate to say that automated tests, refactoring, and other code quality measures are forms of insurance against future requirements changes.