This is a rationalization. Whether or not you work on products that literally automate jobs away (and a surprisingly broad set of apps does that --- that's what "productivity", in the economic sense, means), your compensation is supported by the demand those sectors of the industry creates.
I agree that people admire doctors and don't give much thought to the problems their industry has created (in the United States).