Terrible advice. You spend a very large portion of your life at work. Making friends that you can blow off steam and share memories with and building a network can be done simultaneously.
I'm in my 60's. My observation is people that pick up friends at work during their career always have a job, get recruited for jobs, they survive layoffs more often. And deal with stress at work better when things get shitty. So it's a positive thing for your career and mental health.
Management thinks employees having work friends is a bad thing. Cause it reduces the power they have over employees.