And this isn't any special for tech. Tech companies are not asking for special treatment, they are currently treated like any other company in accounting terms. Governments are trying to treat them in a special way.
If you have a company that makes a chair in France for $20, ships it to Spain (let's day for free) and sells it in Spain for $0, how much profit did this company generate in each country?
This is exactly the same accounting as the tech companies, but their services have a very high fixed cost and a null variable cost, while the chair maker is the opposite.
Your "parasite" analogy doesn't make any sense. Trade relationships add value to both sides, but if you wish your people to have a worst product for a higher price, go ahead and ban competition.
As an example look at the similarities of clothes and shoes donations from the west to Africa with opening up to parasitic businesses. All these charity efforts have done is undermine the local clothes and shoes production and market making it impossible for people to build businesses and create jobs.
If I open up a new fictitious nation to all trade and allow them all tax write off on investment in other countries then I don't get a prosperous nation. I get a basket case that cant compete with foreign existing industry, can't develop competitive local industry or employment, and likely stuck in debt because tax revenue would be so low.
It isn't "zero" at all. That's not how economics work.
A company is fully within their right to choose how it spends money but the taxation should work on an individual nation basis. Why should investment in country A come at the expense of tax revenue generated in country B?