This is a fundamental misunderstanding of "middle class," which has no connection to median income, but is exactly what it says on the tin -- a class between the upper classes and the lower classes. The earliest recognised middle classes were the wealthy merchant class who had similar wealth to the upper classes, but less social capital -- they were definitively above the lower class, whose labour was owned by the upper classes. These were the free men, or yeomen, of the middle ages, for instance -- people who owned their land, likely had their own businesses, and weren't beholden to the upper class.
In more recent times, such as the 18th-19th century, the middle class expanded dramatically to include typical professionals, such as doctors and lawyers -- people who may rub shoulders with the elites, but whose wealth was still tied to their jobs. If their business failed, they would often no longer be middle class, whereas the upper class could likely fall back on connections and maintain good social standing. The median worker was decidedly lower class.
This structure broke down somewhat in the US and, to a lesser extent, in western Europe in the post-war era, due to an abundance of demand for labour, which allowed lower class workers to enjoy traditionally middle-class luxuries, which included widespread homeownership, often multiple cars per family, etc. But don't make the mistake of thinking a well-paid factory worker was middle class -- they were working class.
Most software engineers worldwide are working class. In certain pockets -- the Bay Area, Seattle, etc. -- or certain industries -- such as finance -- they are closer to middle class by earnings, but still working class by vocation, as they (we) work for a living and do not own our own businesses (as many doctors and lawyers do).