I don't think most lawyers, doctors, and software engineers are "middle class". They might claim to be "upper middle class" to avoid being categorized as "upper class" as many wealthy people do.
But a regular software dev or a GP is the perfect representation of a middle class - having enough money for comfortable life, travel, owning a house, new car, leisure activities and having money for investments.
If one can’t afford these (all at the same time) - it is not middle class. Middle class is not a “median - average salary class”, by a long shot.
Can you define "upper middle class" and "upper class" in a way that excludes all but "some of the most successful" doctors, lawyers, and software engineers? Because I sure can't.