Excellent insights !
Not becoming friends with your co-workers is even more important for managers.
Establishing clear boundaries, operating with integrity, being brave with good intent and empathetic are essential for a successful and worthwhile work life.
Unfortunately sometimes even with all the above you will lose because favoritism wins over everything else. Bosses will forgo performance over how much they like one person over the other.
If that happens time to move on.