"Isn't it up to a country to make itself attractive to investors, i.e. by not pulling all that shit?"
Yes, but it would defeat the purpose of a trade agreement.
Moreover, if country ABC signs the agreement, indicating 'they won'd do this BS' - and then they actually do do it - then they get access to other markets while cheating.
The agreement is supposed to prevent countries from cheating.
It has a side effect of preventing governments from doing things they ought to do - for example, punishing international companies from polluting etc..
It's a tricky problem.
There should be clauses that allow governments to make laws to stop companies from polluting etc.