An unfortunate reality of PID and internet blow horn. I don't see it as a free speech violation unless platforms intended to keep users anonymous defame or dox their base. Clearly a well informed user would still assess the risk vector of being hacked and exposed.
Not sure on legality, but my employer insisted everyone remove their employer affiliation from social media profiles as saying something that would draw negative PR could get you fired. Been in industry for a couple decades, first time I seen a don't say dumb shit online when linked to employer. Our marketing and a bit of sales operates with the social media space so got weird last couple years.
Every employer has had it in my contract, is it entirely enforceable, perhaps not.
People who think contracts are entirely enforceable are often wrong. For instance I had one once with an extremely aggressive noncompete clause with the geographical area of all of Western Canada including Territories.
Everything was hunky dory until the day I put in notice and it became vicious and they did threaten legal ramifications should I compete so I got my lawyer involved, and not a remote chance they could enforce that size of an area due to infringement on my ability to generate a living for myself, it was considered far too predatory.
With all that said probably the average person isn't going to take the time to go through such a process nor can they carry the cost of legal fees until settlement.