Iran only really fits half into the latter category because the people are vastly more liberal than their government.
And if you look at polls (can't find them right now sorry) Iran is actually one of the least Muslim Muslim countries around when you drill down into dogma, e.g. belief in heaven, belief in angels, such things. The average Iranian is about as Muslim in their private faith as someone believing in reincarnation is Christian.
Iran didn't turn tribal and is still diverse AF. Don't confuse the people and overall culture with the backwards government which isn't exactly popular.