The reality of the Valley has much more in common with my fraternity house in college than anything else really. That's not to say that the hardworking hacker doesn't exist. They absolutely do! They are the ones everyone else in the Valley is taking advantage of.
(I'm not saying it's a bad thing; just something I've noticed)
You forgot watching sports.
Note that in every case, it's actually a subtle matter of one-upsmanship. Eating redder or more meat. Sleeping with more or better-looking women. Drinking harder or larger quantities of liquor.
Writing more lines of code in a more obscure language.
You could find plenty of guys willing to defend sports on their own terms. I don't think, if you let them talk for a day, they'd come out with anything like what you're putting in their mouths. I do think the things they'd tell you about sports are plausible enough as the "real reasons" they're fans. In my (admittedly not deep) experience, analysis of the action is a big thing. Criticizing the performance might rise to the level of a minor phenomenon. People are perfectly happy enthusing over great things that their heroes have done.
A man might enjoy throwing around a football because of the visceral experience of a solid catch, the nostalgic recollection of doing it with his dad, the anticipation of doing it with his son in the future, the vicarious simulation of a quarterback he looks up to, the amorphous pleasure of exercising, and because he can throw it further than his buddy.
Yes. People from San Francisco want the 49ers to win, because they're representatives of a kind. But there's nothing particularly manhood-affirming in this experience. People don't want their team to win in order to feel more masculine; as you said, it's a tribalism thing. That's why sports-watching is accompanied by other activities, like exclusion, beer-drinking, steak-grilling, and so on.
The reason you watch sports to affirm your manhood is because you feel you know better. You could, in their shoes, stomp the other team into the ground. You could tell your team what to do and they'd do it and they'd win. This isn't tribalism; such people would happily switch sides in order to prove they could win from there, too.
Listen to the content of the conversation. A bunch of guys, sitting around, agreeing with each other on what they would have done instead. If their team loses, the tribally motivated will say, "Better luck next time." Those who are motivated by masculinity say, "Should have done it better." It's indistinct if their team wins; they have nothing to prove because they backed the right horse.
People usually don't watch sports to affirm their manhood. Activities for doing that tend to be active. But when they do, it's not about tribalism.
Nobody ever promised that career progression would be based on coding chops, especially when each jump up the ladder means less time coding and more time people-hacking.
It is. It's one of those archaic masculinity expectations that hangs around. "Real men" are supposed to eat red meat, be promiscuous (until 30 or so), and be experienced with liquor. Men who don't enjoy getting hammered are seem as "off", unhealthy, or aloof.
We might hate that it is this way, but mainstream business culture (which has successfully colonized the Valley, making that ecosystem a Disneyfied farce of entrepreneurship having little to do wtih true technology) is still heavily invested in gender roles and "real men" nonsense. Being a nondrinker is a pretty serious professional handicap because, ultimately, people give professional favor (promotions, good projects) based on personal affinities that can be hacked with chemistry (specifically, ethanol) but rarely (certainly not reliably) with hard work.