I believe that the issue is that the Earth's crust isn't uniformly thick, and that there are places where one could drill for miles without reaching magma/suitable heat sources, and other places (Costa Rica and Iceland come to mind) where the suitable heat sources are essentially on the surface.
Or, looking at it another way - oil drilling happens all over the globe and "hitting magma" isn't really a risk they're concerned about because it's so deep, that even the industry concerned with drilling too greedily and too deep doesn't intersect with it.