In my opinion, everyone needs to feel significant. It is a basic human need.
Most people don't feel significant in their daily lives. They feel like their job, parents, society, government and maybe even their spouse have control over them.
Joining a group gives them a feeling of significance. That becomes part of their identity and no matter how illogical or misguided the dogma of that group is, they will defend that group because anything different is a personal attack on that person's identity.
It doesn't just have to be religion. Take guys who are overboard fans of a certain sports team or women who list shopping as their 'passion' in life.
In most instances, these people do not have their own true identity so they need to define themselves by these groups.
Most people just want to follow.