That is right. But Iran is not a dictatorship either nor a military regime. The thing is any country without a strong economy and supremacy in science then absolute democracy and freedom, the kind you are talking about is dangerous. Our third world people can not handle themselves when given these powerful tools, not only that but even in developed nations they have limits on freedom. In Germany you can not be a socialist-nationalist. In US you can not run for presidency of US if you are a Muslim. And in UK it is illegal to try to remove the queen from power and trying to do so means treason. Iran is no different. They have red lines but since they are under attack by west their red lines are more sensitive.
As for Egypt, some mistakes caused it to fall behind. One was absolutism of the military, which controlled everything. The other was, the wrong economic policies, with government still owning apartments and renting them out on subsidized rates which was ridiculous. Renting a 1000 dollars per month house for just 1 dollar per month is not a good economic policy. Then Egypt had just Mubarak and everything revolved around him, there was no multiple centers of power to compete with each other and keep each other in check as happens in a relatively democratic country. Also Egyptian regime had disregarded the Islamic identity and had chosen to become a client state for America which meant US interests came first and Egyptian interests were only second.