While there might be legal relief for employees that lose their job, there are important steps employees can take prior to termination.
Self-awareness is an important skill for an employee. Employees should attempt to determine their strengths and weakness, and how those skills fit within the corporate goals. An important question to ask is what is the company looking for out of the position? And, are you providing the necessary results?
Employees should also ensure that the perception they want to have within the company meets the reality. Self-awareness can additionally help employees determine negative perceptions, and hopefully turn those into positive assets.
Finally, after a termination, try to figure out the exact reason. This can hopefully avoid the same issues in the future. While the reason for termination could be discriminatory or illegal, there might be other factors in place. Focusing on those factors, and improving those skills, will be beneficial for long-term career success.