Flip side, you don’t have to be besties with your colleagues. Enjoying time with them while you’re colleagues is an end upon itself. You’ll statistically have about a dozen jobs in your life, which’ll bring in close to 100 colleagues into your life. Chances are you can’t and won’t remain friends with all of them, and that’s ok too.
It's not impossible to do, I know plenty of people who make real friends at work. But it takes intent to make it work like any human relationship, invite them to dinner, go to movies, play video games, etc. Go overboard to get over the activation barrier but be selective because you can't do that with two dozen people at once.
Next job was a lot more family people and we rarely went for drinks together. I am not really in touch with them any more (perfectly nice people but the bonding never happened).
Of course they didn't go drinking, they had to get home to take care of kids. Or, like me, they don't drink. They might still invite over other families to go hiking or camping or maybe even know other parents from school.
Not saying that was necessarily happening, but now that many more of my friends have kids (I don't) I see them do this all the time. They can't really hang out without a way to distract their kids. Board game nights are much more likely to connect than drinking.
I don't think that's a good idea. When people elsewhere on this thread have commented that back in the day people's main opportunity to make friends was at work, they didn't mean that work gives them opportunities actively but rather that it gave them personally the opportunity to personally create a relationship with a coworker.
Agreed? There's a huge difference between the relationship you create by inviting a work friend over to your home for dinner and video games (or going to a bar even) and the relationship created by the "team" going to a "team building activity" together. Don't rely on work to provide the context to make a friend, but it's fine to rely on work to provide an opportunity to make a friend.
Within reason and assuming good actors, etc. I probably wouldn't share every detail of my personal life with work-friends and certainly older generations did not. I suspect the two are related; you have to be more guarded with work friends because social vulnerability can be very risky in a work environment. My mother didn't talk about her disability with work-friends much, only the work-friends she'd invite over for dinner. I share about my condition much more because I want and expect even "just" work-friends to understand and accept my limitations. The story I hear is that it didn't use to be at all safe to be vulnerable like that with colleagues.
Good colleagues are very important. They are the people you are going to spend with half of the time when you are not sleeping. You will spend more time with them than with anyone else, including the people who live with you. So how you interact with them can make your days pleasant or miserable for the following few years.
Even after you leave the job, if you stay in contact (like, having a lunch together once in a year), you can give each other good professional advice, recommend good jobs, and provide a reference. That can make a big difference, too.
So it is definitely NOT "all in vain". However...
The fact that you spend so much time together and face the same problems, this will all instantly disappear the very moment you leave the job. (It may also evaporate gradually if they leave the job sooner. This part is completely outside your control.) So leaving the job means losing it all, but staying in the job is not a guarantee of keeping it. Better not to get attached. (Being attached also weakens your negotiating position against your employer.) This is the opposite of friendship, when you expect your friends to be there for you especially when you face important changes in your life.
Friends, you choose freely. Colleagues, you get randomly assigned. It is important to be able to have good relationships with people you get randomly assigned. But this is completely different from friendship, where you choose people depending on how much you click with each other, and on the potential for the relationship to grow. If you find out that someone is only capable of a shallow level of friendship, you recognize they are a waste of time, and you replace them with a better friend. When the person happens to be your colleague, you continue to be polite to each other, understanding that this is the level you can't get beyond, but it is still valuable to keep this level. You have different expectations for friends and colleagues. With friends, the relationships start organically, and they grow over time. With colleagues, the relationships start artificially, and they mostly remain at the same level. With friends, you have an emotional connection; you take risks and make yourself vulnerable, in hope of making your connection deeper. With colleagues, you behave professionally, in hope of staying at the same level indefinitely.
(Now, there are situations like having a beer with your colleagues after the work, or a teambuilding organized by your company. They blur the lines; in case of teambuilding it is intentional brainwashing. Don't get confused. Relax and enjoy the situation, but don't forget that you have actual friends outside your work who are not with you now; remember to get in contact with them later.)
Sometimes, you accidentally get randomly assigned a colleague who is actually a friend material. Someone, who you would become friends with, if instead you would have met somewhere else; someone whom you would remember and try to meet again. If the feeling is mutual, great. But it is easy and perhaps tempting to overestimate this. You will probably find the true answer only after you (or the other person) leave this job.