Political leaders are representatives. They are not just administrators creating a "product". Part of their role is to express their voter's opinions in government.
Because of this people want a person who shares their opinions on a range of matters. They want a person who thinks and feels the same as they do. It is unsurprising that a white businessman in America would think that another white businessman would share his thoughts and opinions. Similarly, a black christian teacher may feel that another black christian teacher would be a better representative, as they would share the experience of racial discrimination, have a similar set of moral viewpoints and a similar opinion on the role of education in society.
In Indonesia, it would be unsurprising if a Muslim felt that another Muslim would represent them better. It would be unsurprising if that voter considered religion as an important factor.
Other factors correlate with religion. For example abortion policy is an important issue in American politics. There is a correlation between some forms of Christianity and particular opinions on abortion. If you choose a representative based in part on their position on abortion, you will implicitly be choosing based on religion.
Essentially, choosing a representative is not like choosing a phone. Its not even like hiring an employee. Who is "best" is not an objective fact.