There is not a simple answer to this, because it depends on your attitude to risk.
> Nothing beats being debt free.
Depending on your risk appetite, being debt free can come more quickly by investing than by paying off debt.
Your suggestion would mean nobody saves for retirement while they have a mortgage, for example. Fine if you are happy with very little risk, but for many that would be a bad option (waiting until you are 50 to start paying into a pension).