The thing is they had years to figure it out. These issues we are seeing are not new. They are merely repeats of existing observed issues.Iran is a more pariah state than NK. At least NK gets PRC and Russia(whatever they can muster left) backing. Iran is surrounded by enemies and unable to make friends besides the even weaker Iraq.
If Iran leadership survives this, they need to reform and actually make some solid friends near its border even at the cost of discarding some of their major principles. Make economic reforms, improve their people's life that they are willing to support the government, not fearful of the government.
I do hope Iran gets it act together. But we might be approaching a full hot war globally quite soon. The window to do so is very small compared to the reforms needed.