Companies' decisions to hire and fire people are not personal, they're just business. They need X number of workers for a set of tasks, they hire them. They no longer need that many, they fire them. It's a purely economic decision. Talent and experience are not even much of a factor.
Don't blame yourself. Don't take it as a measure of personal worth. We're all kind of at the mercy of the market for our labor.