If Israel attacks the Iranian nuclear facilities and suffers massive retaliation, it would only clear the way to Egyptian dominance. Egypt will continue building a conventional army, to be inherited by the politically victorious Muslim Brotherhood, and would likely develop nuclear weapons, feeling that the US Camp David guarantees protect it from Israeli reprisal.
Israel shares a political common ground with Iran: both need to do away with Egypt and Saudi Arabia. As far as Israel is concerned, the US military aid allowed Egypt to develop a relatively agile modern army, and Saudi Arabia has both a huge conventional arsenal (which it can loan to Egypt) and nuclear weapons (developed by Pakistan with Saudi money). For Iran, Egypt is a major contender for regional influence, and Saudi Arabia is the oppressor of Shia population conveniently settled in Saudi oilfields region.
Israel should prefer Iranian Shiite dominance in the region to Egypt’s Sunni one. Egypt will soon become even more radicalized than Iran, when Muslim Brotherhood takes the power. Iranians are disenchanted with mullahs but Egyptians are all for Muslim Brotherhood. So it’s not a choice between a secular peaceful Egypt and the Ahmadinejad state, but between the two heavily armed Islamic fundamentalist states. In such an outlook, Iran is preferable as it did not start wars in its recent history – unlike Egypt which attacked Israel continuously, and continues to do so through the Hamas-Muslim Brotherhood proxy.