I am 90% certain that the reason I don't like to get attached to people is because of politics. I am not necessarily talking about Republicans vs Democrats (even though you will probably be higher on my list if you didn't vote for Trump).
One of the hardest things about having friends in a similar environment to you is that you are all climbing the same wall and sometimes being put in the ring to fight against each other. Even if you don't realize it's happening at first, sometimes people will use your friendships against you.
I learned this the hard way recently. When I was at Pier One, this happened so often that I couldn't count, but the difference was we weren't supposed to be friends. We had to act cool and composed and deck each other in the parking lot.
In a career job that is full of many forms of office politics, leadership challenges, and miscommunication, it is impossible to avoid.
Is it best to avoid attachments to co-works in the first place? Is it best to surprise them when you think about leaving? Maybe it wasn't directly their fault, but they played a good hand at the end.
Work is fun when you are doing something you love. It is better when you enjoy the people you work with.