Similarly if a law was enshrined that there could be no leaving under WTO terms, an incoming government (if it had a majority) could merely overturn that law.
I think that is overlooking the difference between domestic law and international treaties.