Muslim rulers did atrocities, yes, but they were Muslims (barring the few who didn't really give a toss about religion, but nobody really heroises them), and as a result their victories greatly benefited the other Muslims with them. Did you forget that it was Shah Waliullah, a native of Delhi who invited Ahmad Shah Durrani to invade the region? Or the fact that Puran Mal was killed by Sher Shah Suri at the request of Muslim women in Madhya Pradesh? Or that Fariduddin Ganjshakar, a Sufi Punjabi, was a spiritual guide for Qutb Uddin Aibek, and married one of his daughters?
Muslims of the region loved these rulers and sided with them over the Kuffar of the region, even if those Kuffar were closer to them in blood.