The real head-scratcher is why the US refused to extradite the Shah back to Iran for trial. What a different world we'd be in right now: the hostage crisis never would've happened. Moderates would've been empowered. Iran's completely valid historical grievances would've been addressed. Who knows, maybe the Iran-Iraq war never would've happened. The US wouldn't have provided WMDs to Saddam Hussein. No Gulf War I and II.
Why Mosaddegh was denied what Chavez was allowed is not clear to me.
By 1979 it was no longer possible to marshal public anger towards the UK whose empire had been completely dismantled. Meanwhile, the US continued to support the Shah's regime by selling weapons until 1979, and this was probably at least as important as the coup for the image of America as a public villain during the Islamic Revolution.