In the Republic, it is clear that Plato is critical of democracy. However, there are also indications that he endorses it as a good form of government. Given his historical circumstances, Plato may have realized that philosophy flourishes in democratic cities, but he may have thought that democracy only works properly when kept under scrutiny.
Indeed, Plato says that democracy is the second worst form of government in the Republic. Only tyranny ranks lower. However, Plato says that men may philosophize in the democratic city. He does not mention the existence of philosophy in any of the other regimes, though the philosopher kings could provide a limited world of philosophical inquiry in the kallipolis. Hence Plato criticises philosophy while also acknowledging that it enables the very sort of endeavour that he undertakes in the Republic.
Consequently, Plato may have thought that democracy requires a critical populace in order to work well. Greek historians such as Thucydides who lived nearly simultaneously with Plato criticised the Athenians for being fickle and double-minded. The Athenians had, through democratic vote, chosen policies of imperialistic expansion, unrestrained spending, and foreign exploitation. Socrates himself was put to death by an Athenian jury. These things must have troubled Plato, and he certainly must have thought that the Athenians should think more clearly and critically about their policies. If this is the case, then Plato could have intended to criticise democracy for the sake of guiding Athens from its wayward tendencies.