Not at all. What Musk did is absolutely not the norm, and even in that scenario apparently he used number of commits as deciding factor in who to lay off so in that scenario defintiely the people who decided ot work 5 days a week would be much safer than those who would have worked 4.
In reality, layoffs are all about improving efficiency and reducing OPEX by removing employees who's output to cost ratio is poor. That can mean some relatively productive senior employs are eliminated due to high salaries, but in general layoffs are done by performance factors at equal grades. I know, I have been in this process many times .
And anway, all of that is completely besides the point. It is quite logical that people that decide to work 5 days instead of 4 days per week will simply naturally have contributed more, networked more, been available in more meetings, critical outages, presentations.. While a company that offers a 4 day week at 80% pay may try and normalise some KPIs, at the end of the day human nature always means there will be biases that are impossible to remove.
Your last point is also not exactly true. OK, salary increases can be easier by changing employers but this isn't universal , e.g. currently market conditions are pushing salaries down in IT unless you are in specific areas like AI. For promotions, the opposite is true and it is nearly always easier to get promoted internally, especially at more senior levels. Companies don;t want to take a risk in hiring an external candidate into a senior position if they already have good evidence that an internal candidate is performing at the right level. The only factor is the employer might not need the more senior role at the current time while other companies might be looking to fill a position. But it can be challenging to get a real promotion that brings increased responsibility if you haven't evidence that. Perhaps you want to beocme a manager but have only worked as a IC - don;t expect any other company just to pick you and give you a chance. Best bet is getting internal promotions, gain the experience and then if thigns are still not where you want them to be start applying elsewhere.