Famously, the Khazars back in the 8th century realized that their shamanistic pagan religion had hard in-built limits on scalability.
Translation: they could keep the paganism and die under Islamic conquest, or they could adopt a monotheistic religion that provided the strongest possible chance at social cohesion.
They looked at Islam, Christianity and Judaism in depth and settled on Judaism, and then went on to grow & dominate the region for the next 2 centuries.