I’m really sorry this happened to you. It’s very unfair. It’s so thoughtless of managers to insist that everyone is smiley and perky all day at work. Obviously life isn't like that.
People are ill, they have difficulties in relationships, situations outside of work, bereavement, break ups, parenting, all kind of things.
Insisting on long term pretence from everyone hurts employees. It’s bad for employers’ legal risk and staff retention and recruitment. Employers may have legal liabilities around discrimination, if imposing ‘attitude’ requirements or behaviours that are not directly work related.
Neurodiversity for example is very common in the population but is only now beginning to be more widely recognised. And for some people their profile amounts to a social communication disability.
Some staff in any company will be masking to the limits of their ability just to get through the social demands of work and be exhausted and distressed by it at home. Some won’t be able to mask at work in every situation and will express their irritation if overloaded.
All managers should already be expecting to work with staff with different challenges and strengths in different areas anyway, if they are decent managers. And also not all types of jobs or workplaces suit everyone, but also many workplaces exclude staff with disabilities more or less openly or fairly/legally.
Overall the workplace has changed in its social expectations and also level of sensory stimulation a lot over the past few decades and this expectation of all staff going above and beyond socially is relatively new. Not all workplaces can be like this though otherwise they will exclude staff inappropriately. I feel like once you see this at work, you can’t unsee it.