All those "Hindu" people who got attacked were under foreign rule and providing tributes/taxes to invaders. There were raids on Surat and Bengal, both of these principalities were under enemy rule and the 'Hindu' subjects were happily paying taxes to strengthen the enemy. They got a well deserved hammering.
It's the Hinduness of these subjects that is suspect, not that of the Marathas for attacking them. The Hinduness of these so called 'Hindu' subjects that was incidental, like today's liberals who lick the feet of enemies for personal gain at the cost of the Hindu cause and then conveniently claim immunity from castigation by other Hindus, proclaiming that "we are Hindus too". Such 'Hindus' have always deserved a good hammering. They were Hindus to the same extent that Arundhati Roy is Hindu.
Bengal had dug trenches to prevent Maratha cavalry raiders from coming in. There are even Bengali poems about the
Bargi raids. It's great that the wound has left a deep psychological impact which has endured till date. Glad to do it again if need be. Some people understand only that language. The trenches still exist in Bengal; It's called a "Maratha ditch".
https://en.wikipedia.org/wiki/Maratha_Ditch
The Bengali folk poem goes..
Khoka ghumalo, para juralo, bargi elo deshe
Bulbulite dhan kheyechhe, khajna debo kise?
Gist : Basically, I have no tax left to pay you "invaders"..
The missing context in this poem is that these people were at that time under the rule of Alvardi Khan, who, according to them, was not an "invader" so they gladly paid taxes to him but Hindu Marathas on a mission to saffronize India were the "invaders". It is because of this charbi that they got hammered, lost their money and whatever little of their dignity was left from renting out their loyalty to Alvardi Khan.