US taxes us on capital gains. OP is asking why the same money is taxed twice. You have simply restated the scenario what OP is asking about. The question is why are corporations taxed , not, what would happen if corporations are not taxed.
You seem to be talking past the parent comment. Their point is that a foreigner can make capital gains on an American company without America getting tax money. Double taxation patches that up.
And why is it wrong? Either they sell and/or operate in the US - so US sales tax is paid and their US employees/owners pay their tax - or they do not, no reason to pay tax there.
Just to add sales tax is a State/County/Municipal thing. I just voted on a 1% sales tax increase for my county, for infrastructure, cyber security, and other public stuff.
But with your model the US government and the government of California would receive no taxes beyond those owed by the employees.