Islamic scholarly education was nearly always grounded in religious-legal training

Evidence

In whatever field a scholar or an intellectual ultimately specialized, his or her basic “undergraduate” training was nearly always sharʿi. Those fields that prepared the student for the study of sharʿi subfields also prepared other students for nearly every other field, be it theology, adab, astronomy, or mathematics. — Wael Hallaq, Restating Orientalism, 152