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.)
The professions that were mentioned in the grandparent were all things that can easily be tested in an testing process. I.e. _play_ the guitar. Cook a meal.
Testing a doctor or lawyer well in a limited time is difficult, just like a software engineer. The difference is that they aren't expected to do "side projects" to prove their worth.