Sounds like your friend left on his own terms for a job with better benefits. It’s better to go on terms he negotiated and not have been forced out due to a layoff. Easier to get a job when you already have one.
However, you’re correct when you point out the rug can be pulled out from under you at a moment’s notice if management feels the need to reduce costs by reducing headcount.
Layoffs are always about reducing overhead – salaries, which increase their bottom line. If they could automate your job functions, they would, for the simple reason, employees are just damn expensive.
I know you’re happy for your friend, the question I have, is when you will be following suit?