Bosses, employers, managers, and supervisors in California are legally allowed to yell at, curse at, insult, not help, publicly embarrass, lie about, be mean to, and undermine at-will employees. Employers are really only prohibited from discriminating against, firing, harassing, or taking other adverse employment action against an employee specifically because the employee is a member of a protected class or as retaliation specifically because the employee engaged in a protected activity.
Examples of protected class categories are race, nationality, sex, age over 40, disability, military service, religion, etc. Examples of protected activity are complaints about illegal discrimination, disclosing a violation of the law to an employer or government agency, or filing a lawsuit or administrative claim against an employer for unpaid wages. These are unlawful motivations.
In other words, it is unfortunately perfectly legal for an employer to treat an employee like trash simply because the employer does not like the employee or the employer is just plain mean, even when the employee does not deserve it. This is true even if the employee is the best performer and received the best performance reviews in the world. It only becomes illegal in California for an employer to mistreat an employee when an employee does it specifically because the employee belongs to a protected class or engaged in a protected activity.
When employers yell, curse, publicly embarrass, or disrespect, it is never a good idea for employees to respond in those same inappropriate ways no matter how big the urge to do so. This Business Insider article provides some great suggestions for how employees should navigate these situations.