And yet much of the fundamental work today in e.g. particle physics, cosmology, chemistry, and modern physics more generally relies foundationally on mathematical structures and a corresponding view of the mathematical formulations of the laws of nature that was inherited from religion and theology:Religion and science are definitely opposed.
"The orthodox view of the nature of the laws of physics contains a long list of tacitly assumed properties...It is not hard to see where this picture of physical laws comes from: it is inherited directly from monotheism, which asserts that a rational being designed the universe according to a set of perfect laws...Clearly, then, the orthodox concept of laws of physics derives directly from theology. Indeed, the "theological model" of the laws of physics is so ingrained in scientific thinking that it is taken for granted." (pp. 89-91)
Davies, P. (). Universe from bit. In P. Davies & N. H. Gregersen (Eds.) Information and the Nature of Reality (pp. 83-117). Cambridge University Press.
Of course the above is mostly about the conception of the nature of natural/physical laws within the physical sciences rather than their mathematical structures. It turns out that for much of modern physics, the relationship here is more direct. From astrophysics to condensed matter physics to quantum field theories and beyond, the ubiquity of field theories (classical, statistical, and quantum) are now so ingrained in many physical sciences that especially in particle physics theories don't just rely on the Lagrangian formulation, they are Lagrangians, which explains Kane's comment in the introduction to his text:
"In practice, “theory” and “Lagrangian” mean the same thing."
Kane, G. (2017). Modern Elementary Particle Physics (2nd Ed.). Cambridge University Press.
Both the Hamiltonian formulation (whence comes the foundation of quantum mechanics and most of classical physics as well) and the Lagrangian as well as other basic frameworks relied on in physics, chemistry, cosmology, etc., are based upon the principle of (least) action. This principle originated in the work of Maupertuis, but it was really more fully developed by Euler:
"Euler maintained the theological view of Maupertuis and held that phenomena could be explained not only in terms of causes but also in terms of purpose. He believed that, since the universe was the creation of a perfect God, nothing could happen in nature that did not exhibit this maximum or minimum property." p.167
Cushing, J. T. (1998). Philosophical Concepts in Physics: The Historical Relation between Philosophy and Scientific Theories. Cambridge University Press.
The action principle that is so fundamental not only to our best modern theories and frameworks in the physical sciences but to deriving and testing possible extensions or new theories was developed, like the conception of physical laws, by using theological principles to deduce the "correct" manner according to which the universe must operate assuming a perfect God.
Now, neither I nor anybody I have ever encountered has ever either thought about anything related to theology when making use of Lagrangians or Hamiltonians. Likewise, current views about the nature of physical laws do not trouble many practicing researchers (either theorists or experimentalists) and when they do it tends to be over whether or not e.g., mathematical elegance can lead us astray or whether the group theory that encodes symmetry should take precedence for so many decades over and against empirical evidence.
The point is not that somehow modern physics or chemistry or physical science more generally in anyway relies on religious thought. Rather, it is that even today we can see the results of a previous dependence. Further, if the science and religion were so opposed then one must wonder how it could be that modern physics could have developed (from Newton to Euler and beyond) based directly or indirectly on theological presuppositions.