If we historicise religion in terms of its pagan provenance we can clearly see religion as unreflexive atheism. That reading is precisely what is at stake in Gramsci’s critical entanglement with the consciousness and culture of what he termed the subaltern. Something that comes across rather clearly in his critique of Bukharin’s manual of Marxist sociology.
On the other hand, the conception of the rational in Hegel’s system of philosophy of history is deeply theological — theology here to be read as the mystification of religion through a hypostasis of its material basis. Albeit, the historical thinking of metaphysics and idealism that is prominently at work in Hegel while he is building his system of philosophy (of history) provides us with the resources needed to reconceptualise rationalism as materialism, against the Hegelian-systemic grain of theology as it were.
One way, my preferred way, of reading materialism off Hegel is provided by Althusserian Pierre Macherey’s deconstructive reading of Hegel’s criticism of Spinoza. He also demonstrates a similar approach when in his affirmative reading of Adorno’s mobilisation of Hegel’s conception of negativity in ‘Negative Dialectics’, Macherey rigorously explicates such Adornesque mobilisation of Hegelian negativity as Spinozist conatus, which is an extensional, and thus non-productive, positivity.
In that context, religion needs to be approached not as a closed system of mystification but, like every other thing in modernity (especially, its theologised commodity of secularism), as a terrain problematisable in terms of it already always being internally divided between the materiality that is its emerging or political (re-)emerging, and its mystified, theologised presence. It’s perhaps time now to revive once again the (Marxian) project of reconceptualising reason/rationalism in terms of materialism as constant movement of internal division between idea and matter, and thus as critique, polemicality and politics, rather than get caught in the (Weberian) historicist and positivist binary of rational contra irrational.