If you can retire at 34, then you'll have about 25 years to wait until you can get that money. From 59.5, you might hope to live about 25-30 more years, so you can expect to need money then as well. Possibly more because as you age health care might get more expensive, you'll be dealing with inflation as well. As I understand it, you can only put income in a 401K while you are employed, not gains. So after you retire, you can't add to your 401K through contributions, but if you do side gigs/ etc. you can still add to your taxable accounts. And there are annual limits to the 401K. So if you really only plan to work for 10 years, the most you could put in the 401K is $175,000 (approximately). So it won't be your only retirement fund, you will need plenty of money after 59.5, and you ONLY have your working years to contribute to this tax advantaged fund.
Finally, if you do withdraw, as I understand it, the withdrawal is at your usual tax rate +10%. If you have a top tax rate of 28% right now, but after retirement you'll be in the 15% bracket, then you would STILL benefit from the tax deferment even after paying the penalty, even without a match!
Imagine you are putting in $17,500. Your employer is matching $5,000. And you are avoiding having that money taxed at 28%. Your pay will be reduced by $12,600 a year. Your account gets $22,500. Then, 10 years later, ignoring inflation and gains, you withdraw that money at 15% tax rate and 10% penalty. You receive $17,000. For an original cost to you of $12,600.