1) How does India legally define who is a Muslim?
India does not define who is a Muslim or Christian or Hindu. It is up to the citizens to decide and determine who they are. Government only has laws and policies based on religion opted by its citizens.
2) All other religions exist in Pakistan and Bangladesh, does that mean the sole identity of India is 'not Pakistani'?
Yes. Historically speaking, Indians never had a chance to select to be an Indian. All people who did not opt to be a Pakistani by default became an Indian.