That's exactly how it works. If you buy a house for $500k and have a $300k mortgage do you say the house is only worth $200k?
Another way to think about total enterprise value is that there are two groups of people who have a claim on the business: the equity holders and the creditors. In order to own the business free and clear, you need to buy both of their claims. The total equity claim is the market cap and the total creditor claim is the outstanding debt.