There is identity politics and then there is identity politics. When a powerful community makes its identity the foundation of its cultural power and seeks to impose its rules on everyone who doesn't belong to that community, then that's identity politics.
But when a marginalised group seeks to make its demonised identity the foundation of its resistance against the aforementioned dominant identity politics, then that too is identity politics. They're not the same. The difference is power.
Words and phrases can mean entirely different things when used by people on different levels of societal power structures. For example, generalisation of a powerful majority as the oppressive party is useful and serves to direct attention towards toxic practices.
Generalisation of a marginalised identity as violent or criminal can however direct even more dehumanising discrimination towards them.
Phrases like "Identity politics" and "generalisation" don't exist in a power vacuum. They need to be seen through the lens of power. Any action needs to be informed by what that lens shows us.