No, the mistake was not doing more to prevent the Iranian revolution or at they very least ensuring that Khomeini did not take over.
You’re absolutely right, the US should have done all in its power to prop up the Shah in 1978-79 against the will of most Iranians, intervening in Iran again like we did in 1953 would certainly have gone a long way to solving our foreign policy issues in that part of the world. If only our leaders had consistently heeded this kind of brilliant foreign policy advice!
The Shah of Iran was one of our staunchest Allies and we absolutely should have taken actions to prevent his fall . In fact Carter did the opposite, and took action to stop the Iranian military from doing a counter Coup .