1) For junior positions, both have professional accreditation, with standardized testing that ensures a basic level of competency. Not to mention the mandatory schooling (in most cases).
2) If you screw up as a doctor or lawyer, you can end up with official sanctions on the public record. If you screw up too bad, you lose your ability to continue to do your job.
I've worked with plenty of dead weight developers who wouldn't pass even these nominal competency tests.
Further, it just seems to me it's easier to benchmark your successes as a doctor or lawyer. At least in a way that has meaning to your potential employer.
I think part of that has to do with the fact we pretty much all work on teams. The actual projects themselves might be somewhat verifiable, but figuring out that developer's actual contribution is a pure crapshoot.
I list of successes for a doctor or lawyer are going to be both more individual, and also verifiable (i.e., less likely to be bullshit).
Law actually seems quite similar to programming. You can think of the jury as your users and facts/precedent/laws as the statements available in your programming language. Then your job is to assemble the statements into a program that compiles and that your users want to buy.
why do so many programmers think their job is inherently more special and difficult than everyone else's?
Probably largely because they get paid more than all of their peers when they start their careers.
But potentially life-or-death cases are not limited to death penalty cases, they are just the most obvious class of cases that are life-or-death.
There are far greater numbers (and proportion) of lawyers who work on potentially life-and-death work -- not limited to death penalty cases -- than programmers who do so.
Though for what it's worth this is less a "programmers are awesome and important!" argument than it is a "don't get your view of lawyers from television shows" argument -- if the OP had gone with doctors or something I wouldn't have said anything.