A shared language is a key component of any people and historically oppressive groups have tried to eliminate a language to strip a cultural or national identity. The European invaders of North America, Americas in general and in Australia eliminated all native languages and forced people to "assimilate" by speaking English, Spanish and Portuguese. India before the Muslim invasions had no lingua franca and the Mughal firstly used Persian of Farsi as the court and official language.
Persian was the language of Mughal intellectual life. Since the Ghaznavid occupation of Lahore in the beginning of the eleventh century, Persian had been the official language of the Muslim government and the literary language of the higher classes, but with the advent of the Mughals it entered a new era. India became essentially Persianized and transferred the Persian literary and high culture to South Asia, thus forming the base for the Indo-Persian culture and the Spread of Islam in South Asia. later on with the advent of Urdu which basically retained a large vocabulary of Persian words and script took over as the key language of Indian governance. The British colonialists had particularly targeted Urdu as well to weaken Muslim intellectual and cultural supremacy in India.
Urdu is now very well enshrined as the state language of Pakistan and that as also upset the Hindu extremists. I personally think considering the geographical, cultural, ethnic, and religions links, Persian or Farsi as a second language taught in schools would be beneficial for Pakistan as Farsi/Dari is still the national official language of Afghanistan, Tajikistan and widely understood in almost all of central Asia.
The Mughals were uneducated illiterate thugs who ruled over an educated civilized people.
They needed educated people they could trust and the only people they found were the Persians.
So Persian migrants became the backbone of Mughal courts and the trusted bureaucrats of the Mughals.
Similar to the role of Europeans or Indian skilled manpower in the Middle east.
But Persian remained limited to the courts, the vast public still spoke the local languages (Hindustani) and local schools taught local languages and Sanskrit. Especially since the Mughals never did set up any schools or colleges. From the 13th to the 18th century "urdu" was known as "Hindi" or "Hindustani" or "hindavi".
Its only in the early 18th century, the common language around Delhi began to be referred to as Zaban-e-Urdu, a name derived from the Turkic word ordu (army) or orda and is said to have arisen as the "language of the camp", or "Zaban-i-Ordu" or natively "Lashkari Zaban"
Urdu was promoted in colonial India by the British. Urdu was chosen as the language of East India Company rule across northern India in 1837 when the Company chose it to replace Persian, the court language of the Indo-Islamic empires.