India has never had an invasion in recent times, historically though there are many battles which show how Indians were willing to fight to the bitter end.
In fact I have a different hypothesis, Indians culturally are programmed to fight to the bitter end rather then perform a tactical retreat. Running away from a battle is dishonour in Kshatriya culture, and dying on the battlefield is considered a glorious death.
I know about the cultural notions, yet large numbers of Indian soldiers surrendered and were taken as PoW by the Chinese in 1962. Also, if you look a bit further back in history, you will find Indian history littered with stories of traitors and cowards-e.g the last Peshwa of the Maratha Empire, who ran away from every battle with the British, the gatekeepers of the Mysore fort who locked Tipu Sultan out and caused his death in battle, the famous Mir Jafar, the armies employed by 18th century Indian kingdoms which fell apart at the first sign of defeat etc.
Even if we discard pre-independence examples as being due to insufficient development of India as a nation-state as hence lack of nationalism among its citizens, post-Independence India except in 1962, has never faced an adversary greater than she could handle. Yet. in the few encounters we have had even with terrorists, I see bravado replacing results. For example, do you remember the famous interview given by the MARCOS during the 2008 Mumbai attacks? They claimed they had finished off all the terrorists, yet the NSG later found that wasn't true. Again an example of false bravado, just like Gen. Niazi above.