I'm not sure it's clear that the people who are being fired are directly responsible for the letter being made available to the media. From what I can tell, the letter was circulated internally by the authors and leaked by an unknown number of individuals. If by "defect on the company" you mean "leak the letter", then the company appears to be punishing the wrong people.
One could argue that those writing the letter should have known it would be leaked. But you could also say that about any kind of internal criticism. I'd counter that this argument has the 2nd-order effect of preventing any kind of internal criticism, constructive or otherwise, lest it be leaked at some point in the future.
Not to mention, the "demoralizing" label could also be applied to Musk's public behavior, which is the bulk of the point that the letter and its authors are making.