The more simplified answer : If I was an Indian working in America, and took X amount of the money I was making in America, and paid my income tax from that money back to India, all the while using AMERICAN public services, I don't think Americans will be very happy with that. If I am using tax-funded utilties like roads etc., I would be expected to pay income tax in that country, from my income in THAT country.
However I would not like to pay income tax to BOTH India and America on single salary. Hence the treaties to avoid double-taxation.
Problem arises when I pretend to be have the income "generated" in whichever country has the lowest income tax. That should NOT be allowed. You pay sales tax as an individual. But do you as a person get to pretend that your salary earned in USA was "generated" in Ireland, and therefore pay no tax in USA, and only a tiny amount in Ireland? Why should the corporations get to pretend that, then? This is not "tax optimization".
If I lived in India, the indian government will actually deduct income tax at source. This is a really good idea. It means that the rich don't get away with paying just