And as others have mentioned here, can’t the country you’re resident in simply throw you into jail and demand you have your foundation hand over the money or they’ll keep you there forever?
If you're breaking the law and they can find you, yes.
But there are other reasons for anonymity other than breaking local laws.
If you are in the business of international commerce it can be nearly impossible to satisfy every government and every lawyer in the world.
Anonymity gives you the leverage to operate. It doesn't allow you to be a criminal but it can make international operation feasible.