This is in the context of India, but does a good job explaining the phenomenon: https://unherd.com/2021/04/the-culture-wars-of-post-colonial...
Turkey and Bangladesh are other good examples of countries where elites tried to impose secularism, and succeeded for a time, but which ultimately failed because the public didn’t want it.
Secularism really is more of a process than a law, you can't exactly legislate a culture into people. On the longer term, you need lots of good intentions sustained over decades, and you need investments in education sector to keep them going.
The effort, run from the mid-1950s through to the late 70s by a unit in London that was part of the Foreign Office, was focused on cold war enemies such as the Soviet Union and China, leftwing liberation groups and leaders that the UK saw as threats to its interests
The campaign also sought to mobilise Muslims against Moscow, promoting greater religious conservatism and radical ideas. To appear authentic, documents encouraged hatred of Israel.
Recently declassified British government documents reveal hundreds of extensive and costly operations.
Mossadegh wanted a secular independent Iran, England empowered the mullahs and worked for decades to destroy the secular left in Iran (along with the US). Eventually even the mullahs and bazaari turned against western colonialism.
The west also worked against Nasser's secular pan-Arab socialism, including the French/English invasion of the Suez.