As markets expand and people become richer and more educated better institutions are demanded. A reverse causality is also possible: better institutions improve market performance and education quality. From an NYT article on the growth of the middle class in Mexico:
While cooking dinner, Mrs. Martínez said that her husband’s job had given them the credit and stability they needed to start her own business — a gourmet salad shop in a colonial village nearby. And as is common in other countries with an expanding middle class, such as Brazil, their economic rise has led to demands for better government.
When someone recently stole Mrs. Martínez’s cellphone, she said she went straight to the police over the objections of her father, who warned her nothing would be done. “He was right,” she said. “But next time it happens, I want my complaint to be there. I’m trying to make a living here, and I want a legal life.
In other words, there is a demand (and hopefully a supply) of better institutions.
In the article The Economics of Slums in the Developing World there is an interesting puzzle at the end, when it talks about the "land title paradigm." It says:
The major limitation of the [de Soto's] land titling argument is that it assumes that a lack of formal titles implies weak or nonexistent property rights. However, systematic evidence that land rights are always weakly enforced in slums. As one counterexample, Lanjouw and Levy (2002) have argued that informal rights can effectively substitute for formal titles in slum settlements in Ecuador. In Kibera, where all vacant land was formally reclaimed by the Kenyan government in 1969, here all the members of one ethnic group still claim land rights based on tenancy allocated by the British colonial authorities in the early twentieth century. The fact that most individuals recognized as landlords live outside the slum (Syagga, Mitullah, and Karirah-Gitau 2002) also implies that their informal rights over renters are strongly enforced.