Setting aside that hindsight is 20/20 for a moment, according to Portfolio Visualizer, two portfolios running from 1998-2007 earned:
US Total Stock Market: 6.25% CAGR, 15.19% stddev
Intermediate Term Treasury: 6.26% CAGR, 4.79% stddev
That's a much better risk-adjusted return for treasuries, which are backed by the full faith and credit of the U.S. government. I'm not sure why we're trying to retroactively pick a winner in 1998, but someone could reasonably defend the choice of treasuries even using the benefit of hindsight.
We were discussing it because OP was bragging about going all into treasuries (after selling his stock holdings, though it now sounds like they were negligible) in 1998, and how that money is now paying for his kids college. I merely wanted to point out that someone who didn't sell their stocks and just did nothing would have done a little bit better as of now, even though OP sold at the "right" time.
Treasuries did great against stocks if you pick a stock peak and then trough as start/end points, sure. Why did you pick 2007?
I picked 10 years (1998-2007) as a round number, which isn't a good reason. I actually think you asked a good question, there. But 2007 wasn't the low point, nor was 1998 the peak.
If I wanted the real trough, that would be 2009. From 1998-2009 stocks earned 3.35% annualized, while intermediate treasuries earned 6.1%. And picking the real peak and the real trough gives you what's called "the lost decade" for stocks, 2000-2009. Under that scenario, stocks were -0.27% annualized while intermediate treasuries earned 6.72%. In the actual peak-trough scenario, treasuries beat stocks by 7% per year for a decade.
To me the OP sounds lucky, and they point out some friend who was greedy. But neither of them mention diversification. Would a 50% stock / 50% bond portfolio have beaten both of them? Probably.
OP didn't cite a specific valuation number, but a common value measure is Schiller P/E ratio (aka "CAPE 10"), which uses 10 years of earnings to smooth out ups and downs.
https://www.multpl.com/shiller-peI see about a 30 p/e ratio (10 yr) in 1995, and about 35 p/e in 1998. If the OP used CAPE 10, that suggests selling somewhere around 30-35. But stocks dropped back below that level in 2002... but OP didn't mention getting back into stocks.
If there's a valuation criteria that suggests getting out in 1998, does it suggest staying out for the 20 years after that?