"Doctor" had a long established meaning before the modern MD in the US was concocted: a doctor was a person who had acquired significant knowledge in an area, *AND* had contributed to that body of knowledge. (It comes from the Latin verb "to teach").
The modern MD was created specifically to borrow the prestige and legitimacy of the doctors of the university at at a time when contemporary medicine was at least as likely to cause harm as to help. It created a system of training, but dropped the second prong (contribution to knowledge).
As a real doctor, I find the borrowing of my title an adequate tradeoff for the vastly improved healthcare, but I get a good laugh when a mere MD tries to distinguish that he is a "real doctor." (If he as actually published in a peer reviewed journal, or developed a new technique, he is indeed a real doctor. But they are a small minority).
MDs also like introducing themselves as "Dr. Smith"; real doctors rarely do--I've never done it outside of a classroom.
The DDS is kind of an MD knockoff with the same missing second prong.
Chiropracticy, well . . . they should only be allowed to operate under the direct supervision of real physicians, but that's another issue. "Menace" would be a better title than "Dr." for them, but I digress . . .
And as for attorneys . . . the (american) JD is actually the old LLB (Bachelor of Law). In about the 1960s, law schools started switching over, even offering replacement diplomas to their alumni. It was about some kind of parity with MD.
The LLM is a legal master's degree, almost always in tax in the US.
And then there is the LLD, the PhD equivalent, an actual doctor. These are rare, you see an occasional law school dean and so forth. And, notably, Neil Gorsuch, the newest Supreme Court Justice, holds one. (for all I know, he's the only JSD or LLD to ever sit on the court, but I haven't bothered to look, as it's really not that important).
Substantially all medical school and law school faculty have published and contributed to their bodies of knowledge.
hawk, doctor of economics & statistics