It's incomparably harder to judge the output of a coder vs a truck driver (where you pretty much have 100% visibility into work performance). Hence, companies are wary of hiring slackers or people of low talent, because they know that if they hire one, his low performance may never be detected afterwards. This leads to interviews checking for raw ability (whiteboard tests) and "passion" (show me your github etc.), as both are resonable insurance against hiring a dumbo or a slacker.
Colleagues can usually tell, tech lead less so, and manager is often clueless. Basically the only way to judge someone’s output is to work alongside him for a couple months, and only a few colleagues in the team do that. Maybe methodically reviewing someone’s commits every 6 months or so would also work, but that ignores one’s input into decision making, help and mentoring of colleagues etc.