> Code is a liability
You're over-simplifying. Code in and of itself is neither an asset nor a liability. The minimal amount of code needed to solve business needs with no additional complexity is an asset with some maintenance liabilities attached (same as how a farmer's tractor is an asset that needs to be maintained), with depreciation if unmaintained (bitrot). Any code used to build unnecessary complexity is pure liability.
I would term it a Depreciating Asset, like a car or a building. Bitrot is real.
Yes, if code is only a liability then just delete the code and poof liability is gone.
A liability isn't an inherently bad thing.
A loan is a liability, but you might take one out regardless because you know you can use it to make more money than you'll have to pay back in interest.
That said, I think it's more correct to characterise code as a depreciating asset, as another commenter did.