It is hard to game out the best scenario here. Wait, it really isn't. We should just stop. Make a deal with Iran, accept egg on our face and step back. Why? Because they are destabilized. They are likely to crumble. If we keep attacking then they stay alive. If we go away then they have to deal with their broken infra and deeply unhappy population. They were on the path until we hit them. Then, like nearly every country ever, it gave their government legitimacy. If we walk away and focus, hard, on helping the gulf nations that we just hurt badly it will stabilize the region and allow them to fall. But that will never happen because we went into this due to ego and we will stay due to ego.
What if Iran escalates when US decides to go? I don’t think US can go without leaving a power vacuum, which, given current forces positioning, would benefit Iran most probably. I don’t see a path to helping Gulf nations, which will pragmatically be inclined to work with Iran as neither of them can leave like US can.
> deeply unhappy population
A counterpoint is that perhaps we may have just radicalized a large portion of that unhappy population