But if you contribute to Apache or Lighttpd, you're building a webserver. If you contribute to Python or create your own open-source language, you're building a compiler/interpreter. If you contribute to Lucene, you're building a search engine.
All of these teach you skills that can be very valuable if you start your own company. If you can take your server count down from 27 to 1, that's money that goes straight to your bottom line. If you can spend 3 hours writing a script that fixes a problem throughout your codebase instead of 3 months doing it manually, that's time that you can use to innovate instead. If you can index the contents of the web efficiently, you'll know how to index lots of other things efficiently, and there's bound to be a startup idea in there somewhere.
I don't think "writing some boring glue code for the frameworks our for-profit businesses use" is all that much of a resume boost anyway. Writing Mongrel or Factor or Rails, however...
There seems to be a general cognitive bias in the programming world against maintenance work, which strikes me as a bit dumb because it's both harder and more important than starting new projects. But as long as it exists, I'm going to exploit it, and do high-visibility but useless projects like port Arc to JavaScript or rewrite Tetris in 3 hours instead of contributing patches to JQuery.
This is not unique to the programming world. Starting something and finishing it looks a lot more impressive almost evrywhere than making something that exis´ts better. Just think how much more impressive founding yet another non-profit looks on ones cv compared to doubling the projects of an existing one.
I suffer from the same cognitive biases as everyone else. Even though I know intellectually that getting patches into Rails now is probably harder than starting Rails was, I'm still more impressed by the guy who started Rails.
Someone can tell me all sorts of accomplishments on their resume. They can tell me about some cool NDA or Intranet project they wrote lots of code for. But I can learn a LOT more about their skills from their Github page.
So when I tell students to get into OSS, it's not to get free labor or to make them "pay their dues". It's to give them a better shot.
It also sounds, with they way you put it, that it's the leaders of Project X, telling you to contribute to Project X in order to be hired by the leaders of Project X. Which is, or would be, scummy but I've never seen that advice. Usually it's leaders of project A saying that you should contribute to X, Y or Z because when they or similarly tech savvy people are hiring they'll consider that a good signal, all the more so if it's a project related to your work).
I get very, very worried when I see "contribute to OSS" as career advice, for exactly this reason. No, we won't pay you, but if you could grind out some boring glue code for the frameworks that our for-profit businesses use to make money, that would be great. Why, if it turns out that you're good at it, we might even look upon that favorably in an interview... some day.