Honestly, It was a mistake by Iran by hitting commercial ships just because they used different route in SOH. Nobody would accept Iran tolling the straits anyways. They would rather accept the strait to be closed but never to be in control of Iran and paying it for passage.
The negotiations were going on, Blockade on Iranian ports was lifted, Iran was already negotiating for sanctions relief and possibly assets to be unfrozen. But attacking the commercial ships changed everything.
More importantly, Iran had all the support from the world (atleast overwhelming public support even from the western countries) because Iran was attacked unprovoked and Iran was only defending itself. But attacking commercial ships during ceasefire is not "defending itself". World and its people hate to see oil prices going up because of Iran trying to control international waterway. After these attacks many NATO countries condemn Iran. UK proscribed IRGC as terror organisation. NATO also says US had every right to respond. Its same NATO which declined to participate in US/Israel war and Trump was furious on it.
Also if war prolongs then Iran has already played all its cards, there's nothing much left to play. While US can bring more and more assets. US knows Iran do not have any air power or naval power. US warships are simply immune to Iranian coastal missiles.
IMHO, Iran should have taken the ceasefire / MoU as a victory and should have avoided hitting commercial ships. It needed time and money to build its capabilities before restarting the war.