Because it was a ruse.
Several leaders and juntas, but not all, in the many wars of independence in Latin America in the early 19th century used a supposed loyalty to Fernando VII to grow their base of support that in many cases were not clamouring for independence or had any ill-will towards the king. Through this, juntas and leaders could proclaim home rule in the name of Fernando VII in opposition to the illegitimate monarch installed by Napoleon after 1808.
Miguel Hidalgo certainly took advantage of this "mask of Fernando" (as its known historiographically) to shield himself and the nascent independence movement in New Spain from any accusations of disloyalty towards the king. Although Hidalgo did not take pleasure in putting on the mask of Fernando VII, he mixed loyalty to the monarchy with attacks against Europeans (Gachupines) in New Spain in his famous speech in Dolores. This worked wonders for Hidalgo and revolutionary movements around Latin American who appealed to loyalty to the king. It might seem strange to us as to why revolutionaries would spout a different ideology than the one they truly wanted to achieve, but a closer look at the contemporary context of warring movements and even governments meant that in those fateful first years of the independence conflicts, you had to thread a fine line so as to not lose supporters to other groups, sometimes as close as a different junta in a different city. Furthermore, we can't assume that all revolutionary leaders and juntas were looking following republican principles. José de San Martín, for example, was far more interested in a constitutional monarchy than a republic.
Predictably to us now, the ruse sooner or later stopped working and many threw off the mask when the time was right. This included Hidalgo who stopped evoking Fernando VII's name to gather support for his movement.