They don't, but not because they don't want to - it's because it's irresponsible for them to. The occupation of a lawyer or a doctor professes some privileges but also creates legal liabilities. As a lawyer or a doctor, you're not going to risk losing your license over an advice or procedure given to someone for free, on a hobby project.
(Also, the work of lawyers and doctors isn't creative in the sense software is, but it's primarily a people-oriented service. Which means you need other people to do your primary type of work for/on. The kind of work lawyers/doctors usually do after hours is called research, or just learning. Meanwhile, in software development, I can do the exact same type of work for myself that I do at my job, and end up with a digital product I can enjoy using.)