In some respects it is very much an issue of expectations. When you are hired as a salaried employee, the general pitch used is to “come join the family” / “have a career here”. Consider the case of someone with a family, who has to relocate (sell their house, find a new house, find schools for kids, etc.); being cast aside at the end of a project is extremely disruptive and challenging.
Now, if you've been around the block in the industry you realize that stability is not one of its strong points, and adjust expectations accordingly. In other related fields (film VFX) it is often quite directly set up to have temporary project hires (unsure of the specifics of how the benefits work out there). And of course, as a contractor, the length of time is inherently a part of said contract, but there are often issues with the permitted length of time to have a contractor due to labor laws to prevent abuse (in the USA, depending on state), so things like temporary hourly employees (who are eligible for benefits) also might be used.
But, at the end of the day, it's a bad look for a company to have a hire/layoffs cycle on every project, when that is not the expectation set when hiring. Obviously there are all sorts of reasons why that happens dealing with not having a deep projects pipeline to keep people busy/not burn money on idle people. But no one is going to make the hiring pitch “come join the family but we might lay you off at the end of the project”. ?