The doctor's job is not exactly equivalent. After a day of programming, I feel I could still put in a couple hours of light manual labor or say drive for Uber, but I'm unable to focus intensely any longer. Doctors probably use a much greater variety of skills (and not just intense focus on 100% abstract problems for 8 hours), hence I think their resources deplete slower.
I know that when I've worked at jobs which weren't all about focusing on abstract problems (such as an analyst or a consultant or a project manager), I could definitely put in more hours.
EDIT: Also, air traffic controllers (a job that I feel is more similar to programming than being a doctor) are restricted by law to work no more than 6 hours. From what they say, after their shift is done, their brain is often completely fried.