Libya got destroyed by American forces because it did not have any real deterrent to invasion and Assad literally allowed NATO in to show he had no weapons of mass destruction only to then be toppled anyway.
Seems that playing ball with the Americans does not work as Iran has learned the hard way with Trump breaking their nuclear treaty. It's because America - just like China and other super powers - do not believe that international law applies to them. Might makes right in their eyes, regardless of the pompous self aggrandising crap about freedom and democracy.