while India's indentity has always been Hindu
This depends on the definition of "Hindu".
From strictly religious/cultural angle, certainly not true....from basic fact that there is no dogmatic crystalised definition of "Hindu" to begin with (in the sense that it is often used with the abrahamic religions and certain other cultural systems and identities too).
As a Hindu myself, I am often extremely different to a Hindu from another part of India (or even same part of India)....in very deep ways. You can get extremely different answers (each with written, defined, practiced and inherited basis) for questions that other religions and cultural systems have long settled and made quite clearer bound wise.
This descriptor origins was at root geographic (Hindu, Hind, Indus, India, Sindhu, Hindustan etc etc)....applied to a whole variety of (downstream amalgam of various indigenous and introduced) belief systems.
The other (popular) name is Bharat which is more "original" dynasty based much like the name of Qin emperor in China.
The modern republic certainly was not formed on religious (majoritarian need) basis.
A very large number of muslims stayed within India during partition.....they are as part of Indian identity as any other minority, plurality or majority found within it.
The original (attempted and ongoing) definition, push + sustainment for religious based majoritarian state lies on the Pakistan side in subcontinent.
That has had some counter-influence on India downstream due to whole number of matters.....but that is different subject to get into.
But the Indian republic at its core is not any kind of exclusivist religion identity (or really any kind of identity other than the geographic bounded one and all the deeper legacy it has contained within it nation-wise over a long time).....
....just like Turkey is not either (and it has similarly seen a recent realised drift in various way over time from its initial visionary setup as well).
Those are significant counter-counterforces (versus the drift in a chunk of years) by having the core set up this way as well.