The real difference is that many if not all of the countries in your first list are officially secular. Thus I don’t consider them to be Muslim countries I consider them to be secular countries with a majority Muslim population. The religion and the state are separate.
The ones in your latter list are actual Muslim countries because Islam is their official state religion and some of them like Iran are literal theocracies.
Given that clarification I’ll ask again do you really expect better from a Muslim country?
Yes but their government is a literal theocracy thus things like this happen. If the country was officially secular then it wouldn’t happen and the few citizens who wanted this kind of stuff would have no say in anyone else’s life and might even be prosecuted if they tried to mess with others.