Marx wasn't a big fan of religion, he just saw it as largely a tool wielded by the monarchs (and now capital) to enthrall the workers to their masters. Which is largely a correct reading of Christianity's role in feudal and primitive capitalist Europe.
Religion also played a large role in Colonialism through missionary stuff.
Once you actually analyze Marx's criticism of religion, he's not really criticizing the concept of a God, just the material consequences of the religious superstructure as he had seen is in Europe, America, and the colonies.
His call for an atheist state was more a call for an abandonment of the religious superstructure that had intertwined itself into European politics. Basically a more clear version of the American separation of church and state idea.
You can also see how this actually played out, with the church serving as a bastion for anti-communist activity in the USSR, even today American churches are used as NGO agents of American capital interests, same as the colonial missionaries. There's a reason the religious superstructure of America has shifted so heavily towards prosperity gospel and mega-churches, because religion is not a revolutionary force, but a blank slate that will be used by the existing political economic order to enforce and entrench it's hegemony.