It's pretty clear that it was the British who discovered the connection between Sanskrit (and INdo-Aryan languages) and European languages.
But were the Indo_Aryans atleast aware that their languages formed a family with Sanskrit being the oldest? Did they see Hindustani, Bengali, Gujarati, Punjabi and Kashmiri as belonging to one family?
what did the precolonial Indian linguists think of the languages of India?
I am not a linguist. I am familiar with the history of hindi, gujarati and Sanskrit with some prakrit dialects because we study this at school - and I have always been fascinated by languages. With this caveat I humbly proffer my answer :
Vedic people spoke a form of Sanskrit which is said to have branched off from a Proto Indo-Iranian. I don't know if vedic people knew of the Avestan speakers - or how quickly they forgot that shared bond. Vedic was developed into classical Sanskrit ( the cultured ) through ongoing efforts of grammarians and linguists - Panini being chief among those who perhaps compiled the existing knowledge into his book "Ashtadhyayi" - it is dated from anywhere between 4th century BCE to 4th century AD. This is the Sanskrit as we understand it today. These are both considered old indo-aryan languages.
But, Sanskrit was contemporaneous to various prakrit dialects ( ardhamagadhi, pali ) as both are used in Jain and Buddhist texts respectively. Some wonder if Classical Sanskrit was ever a widely spoken language at all! Besides Prakrit ( Natural ) we see another word for dialects : Apabhramsha ( corrupted - apa prefix meaning morally negative meaning of the root - bhramsha meaning decline, decay, ruin, deviation ). It may or may not have been used to refer to a corruption of Prakrit dialects - or deviation from the norm of Sanskrit grammar. These are collectively called middle indo aryan langauges. We do have grammarians commenting upon the apabhramsa dialects - e.g. Patanjali in Mahabhashya. These dialects even rose to have literature of their own - which was known and was recognized by the grammarians.
Now we come to the final phase of linguistic development : into the modern indo aryan languages. And here I will take a specific case to show that the grammarians - at least - would be aware of the linguistic relationship. In case of Gujarati - it developed from Gurjar Apabhramsha. We see a first attempt to provide a grammar for this nascent language by hemchandracharya. But in the same book, Siddha-Hema-Śabdanuśāśana ( Siddha from the patron king Siddharaj, Hema from his own name and Sabdanusasana - meaning the discipline of the words or rather grammar ) he provided the grammars of several other existing prakrit languages and it was written in Sanskrit. Thus the early attempts to provide a structure to what would become modern Gujarati and Rajasthani were carried out with the awareness of various prevalent languages of the time. Thence the journey into modern standard gujarati is long winding and perhaps not necessary to elucidate here.
To summarize :
The only links on the grammars that i mentioned i could find were in sanskrit. Apologies.
Edit : I added the word hindu scholarship - perhaps in ill judgement. I should have used Sanskrit scholarship instead.