Upper-level bosses probably never had any intention of firing all the workers just because some script automated a portion of their work. If it's a large-scale, decisions like that probably wouldn't be made without considering MPL abstractly or without considering the costs and bad PR incurred when laying off a significant number of people. That part of the narrative was likely more significant in the kid's mind than reality.
And apparently, the sub-boss was already on thin ice. This may have just been the final excuse needed to get rid of him.
Also, much empire building happens by headcount; if the work's all still getting done, better to retain the headcount than to faff around with redundancies.
I got my first real programming job because I automated dumb work and my then-boss handed me a bunch of extra unautomatable administration work; I went and explained this to his ex-boss at the company he'd left and started competing with, and said ex-boss figured anybody the idiot wanted to shit on was worth a try.
Now, in this case we're talking about two people still within the reporting chain, but if $redditor->boss->boss hated $redditor->boss as much as my first programming boss hated the previous boss, and $redditor->boss->boss managed to look good screwing him ... then it seems entirely plausible.
I still feel like it doesn't smell quite right, but it is to my mind way more plausible than people are giving it credit for.
And apparently, the sub-boss was already on thin ice. This may have just been the final excuse needed to get rid of him.