At a certain point it just doesn't make sense to over-optimize for productivity, when the sacrifice (being pleasant & accessible to coworkers) isn't worth the gain (more focus time coding).
People who act like their time has so much value they can ignore and talk down to their co-workers end up with no professional contacts worth anything when they get laid off. "I had my head down coding, I didn't have time to socialize or make friends." Optimal for an hour, maybe, but a losing strategy in the long game.