The labor supply for doctors is constrained by residency programs after successfully lobbying by the AMA.
https://www.baltimoresun.com/1997/03/01/ama-seeks-limit-on-r...
For lawyers, theres no such constraint and the limiting factor is typically attending law school and successfully getting a job as an attorney. The demand for attorneys is driven mostly by the business world and thus the economy. After the global financial crisis, there was a severe contraction in the demand for lawyers and many had to leave the industry. There are many ex-lawyers and law school-trained professionals who chosen other careers.