Egypt is a sufficiently large and complex country to stymie not only friendly foreigners who try to rule it, but its own inhabitants. What seems evident is that ruling it requires the support of the military, and the support of the military cannot be taken for granted by anyone.
That’s what everybody thought Mubarak did for many years, as he may have, until he started working for himself. A long-time dictator can easily develop the delusion that he doesn’t work for the generals, the generals work for him. If so, it was a fatal error. It made Mubarak’s illusion of having the military “behind him” actually mean that he had his enemy at his back.