But you also assume that everyone else shares your method of learning. Your comments imply that both programmers have to code to learn. What if programmer B didn't code at all that weekend, but thought about it in the shower, and chatted about it with a friend, and went for a long walk and drew some flow charts in the sand? Could he have learnt more? Or would he still have to write 10,000 lines of code.
It looks like machismo to me. You have a link to the path of mastery, but the final part of the story relates how the student got so good he could do less work than anyone else, and still get perfect marks. He started out doing too much at the beginning, but got good fast. Sounds like A might be learning something that B already had.