Great question. This is something I'm really interested in for my own research, and the answer depends quite a bit on which Latin American region we're talking about. Generally though, this harking back to pre-hispanic cultures by national elites has been tied to the early independence period. Creole elites (meaning American elites of European origin) used pre-hispanic histories for building national identities in order to distinguish their «new» countries from European influence. This process had already begun in regions like colonial Mexico in colonial times, with these elites developing a « creole patriotism » that helped to air their grievances against a colonial order that did not allow them to hold the highest social positions. At the same time, contemporary indigenous people were since early colonial times excluded in many ways. These pseudo-Indian national identities also very much simplified the complex relations between native population groups of pre-Hispanic times that continue in different forms to this day.
Earlier scholarship like the important work of DA Brading has described colonial Mexico (New Spain) as developing such a creole patriotism especially early, going back to the 17th century at least. More current work, especially Rebecca Earle's great « The Return of the Native » has highlighted similarities in how creole elites in many Latin American regions looked to the pre-Hispanic past.
Earle argues, for example, that from the early 19th century elites in newly independent countries like Peru, Colombia and later Argentina looked to specific pre-Hispanic cultures while downplaying the achievements of other native groups – including the continuing discrimination of native people in their time, that even increased in many parts of Spanish America during the 19th century, with previous colonial protections being taken away. This for Earle partly explains why creole elites throughout Latin America would use especially the Aztecs (of Mexico) and the (Andean) Inca as national symbols – even though they often had little to no connection to these groups and their descendants. This included using pre-Hispanic ruler like Moctezuma, Cuautehmoc or Atahualpa on stamps, statues, literary works and (only briefly) anthems in such diverse countries as Chile, Argentina and Bolivia.
So in different phases of Latin American history, elites drew on pre-Hispanic histories for changing reasons. However, history writing by native authors had continued in places like Mexico and Peru throughout colonial times, and would also be drawn upon by creole elites in the independent period, reifying elements of it in the process. At the same time, the independence period saw an increasing appropriation of native territories and loss of judicial protections that in many ways continues to this day.
I have to get going unfortunately, but hope to add a bit more to this later on. In the meantime I can really recommend Earle's book on all this. For the Mexican case, which I'm more familiar with, you might be interested in this earlier answer I wrote on this very related question : Are native Mexicans considered an indigenous people?. I'm adding my summary from that answer below.
I've looked at three topics in order to trace main developments regarding racial relations in Mexico. This meant looking at the colonial casta system introduced by the Spaniards as a basis for determining racial categories that partly have influence until today. However, these casta categories formed an ideal type that did not come into social reality as envisaged. Next I looked at an "neo-Aztec" narrative developed first by native authors, and taken up by creole writers in the 17th c. This narrative proved influential for the formation of modern Mexico's national identity. It highlighted the high development of pre-conquest Mexican peoples (esp. the Mexica), while describing current native people as "backwards" compared to European ideals.
In the last part I've tried to show how this early modern narrative carried over into the modern national identity. Mestizaje and Indigenidad continue to exert influence as highly problematic concepts, preaching diversity in face of deep-seated discrimination.
A few thoughts as an epilogue -- Not only in Mexico, but also in other Latin American (and other) countries, there are still strong negative stereotypes tied to indigeneity. For Peru, scholars have described how people of native descent would and continue to disconnect from their traditions in order to reach higher positions in society. With the idea of a "mestizo" nation (formed in modern times), people in Mexico have tended to emphasize a supposed mestizo-ness or mixity. On the other side of things, whiteness is still rather tied to privilege and often portrayed positively. Nonetheless or in spite of this, many people continue to hold up their native heritages with pride. While it would be too easy to draw direct connections to the casta system, nonetheless we can see how certain stereotypes took hold during colonial times, were adapted over time, and continue to exert influence.