‘Russia’s invasion of Ukraine could have warned Trump from the pitfalls he now faces in Iran’