Those examples couldn't be less like Musk's strategy. There are both good/ethical and bad/wrong reasons to do layoffs. Musk's primary strategy at Tesla has been to create innovative products that people want to buy in huge numbers.
https://www.inc.com/suzanne-lucas/tesla-fires-hundreds-of-wo...
Tesla arguably chose to fire 1200 people to avoid paying their severances.
https://electrek.co/2019/05/24/tesla-cost-cutting-effort-toi...
Teslas 2019 cost cutting effort included basic hygene products like toilet paper, arguably an inconsequential operating expense. Employees had to bring their own to work.