Investing is always a matter of balancing risk vs reward, with the two being fairly strongly linked.
Risk-free assets generally keep up with inflation, if that; these days advice is that even in retirement you're going to want something with better eturns for at least part of your portfolio.
A "whole market" strategy is a reasonable idea, but not well defined. You need to decide wheher/how to weight stocks vs bonds, for example, and short/long term. And you may want international or REIT in the mix; again the question is how much. Again, the tradeoff is trying to decide how much volatility and risk you are comfortable with and picking a mix which comes in somewhere around that point -- and noting which assets tend to move out of synch with each other (stock/bond is the classic example) to help tune that.
The recommendation for higher risk/return when you have a longer horizon before you need the money comes from being able to tolerate more volatility early on when you have less at risk and more time to let the market recover. That lets you take a more aggressive position and, on average, ger higher returns. Over time, you generally want to dial that back (in the direction of lower-risk if not risk free) so a late blip doesn't cause you to lose too much of what you've already gained... but see above re "risk free".
That's the theoretical answer. The practical answer is that running various strategies against both historical data and statistical simulations of what the market might do in the future suggests some specific distributions among the categories I've mentioned do seem to work better than others.
(The mix I use -- which is basically a whole-market with weighting factors for the categories mentioned above -- was the result of starting with a general mix appropriate to my risk tolerance based on historical data, then checking it by running about 100 monte-carlo simulations of the market for the next 50 years.)