This sort of intuition is seductive, because we're generally told "debt bad, equity good!" But it's not correct, for the very simple reason that debt and equity are, in many ways, fungible: each type of financing can be utilized to replace the other.
To go back to the company A & B example: Company A could decide tomorrow to borrow $500,000 and buy back $500,000 worth of stock. Company B could issue $500,000 worth of stock and pay down its debt. Then, just by shuffling some papers around, the capital structures of the two companies will have been reversed! Yet nothing in the underlying business will have changed for either of them.
But don't just take my word for it! Franco Modigliani won a Nobel Prize for his part in the Modigliani-Miller theorem, sometimes called the "capital structure irrelevance principle" (seriously): https://en.wikipedia.org/wiki/Modigliani–Miller_theorem
It's certainly a complicated subject, but debt is very much a real part of a company's capital structure and can't be ignored when comparing two different companies.