It has to do with who consummated the independent movement. Contrary to the continental Congress that was the mind behind the US revolution, in Mexico it was not the forces of patriots who gained independence from an imperial power. The people that freed Mexico from Spain were the criollos and the mestizo elite. In the colonial system only the peninsulares, could hold the high positions of power, and because of this the criollos felt the need to secure their status, more so with the French invasion to Spain, and the removal of king Ferdinand. There is a saying in Mexican history that translates to something like this “the Native Americans accomplished the conquest and the Spaniard descendants the independence”. The essence of this is that the independent movement of Mexico did not truly wanted to modify the monarchist system but grant equal rights to peninsulares, criollos, and wealthy Mestizos. This was accomplished with the Plan de Iguala that created the Ejercito Trigarante (Army of the Three Guarantees) between the forces of Iturbide and Vicente Guerrero. Forces combined, they asked for the resignation of Viceroy O’Donoju, something that was accomplished with the signing of the Treaty of Cordoba, which is what gives Mexico its independence (or at least ratifies it). As one of the clauses of the treaty of Cordoba, it was stipulated that Mexico was going to gain independence as a Constitutionalist monarchy that was going to be ruled by a transplanted king Ferdinand (who had abdicated the Crown in Spain because of the French Invasion), or another prince from the Bourbon house, or some other European royal.
However, Iturbide included the clause that if not suitable king was found, the Mexican Congress will be able to appoint a criollo for the Mexican Crown, which in turned happened when Iturbide’s Regimen of Celaya marched in the streets of Mexico city demanding the appointment of Iturbide as king of the newly independent Mexican monarchy. The first Mexican Constitution, however, was established in 1824, after Iturbide abdicated power following the rebellion under the Plan de Casa Mata, and because of the disillusionment with Iturbide’s empire, the Mexican political elite pushed for the idea of a republic following the Constitution of Cadiz.