If Elon had joined Twitter, and spent time understanding the business and environment and then excised the people he felt weren't contributing towards his vision, that would be one thing... but he has made arbitrary judgements based on absurd metrics like lines of code or willingness to show up at 1am to draw on a whiteboard, he has not made judgements based on the quality of the work or the value people have delivered.
Likewise, to suggest that a software engineer is bad because they were a part of a team that built a "...slow-as-molasses JavaScript-heavy microservices Rube Goldberg machine..." is absurd: what if that person was the only reason that it wasn't 10x slower? What if, they were the lynchpin in that team ensuring that brought everyone else up to a much higher standard which ensured that what they built was usable (even if it was bad)? You cannot judge the contribution of an individual without considering the wider context.
I have no problem with a company cutting most of their software engineers (I encourage clients to minimise their exposure to software engineers, I encourage careful hiring over volume) but what Elon is doing is... not that.