There are ample reasons to prioritise debt payments over investments. There are an equal amount of reasons to invest instead of paying down your debts. The answer probably lies somewhere in the middle, as usual.
For some (Dave Ramsey), paying off debt is all that matters. For others, investing it is. I think differently. My thoughts are that you should work on building your net worth by getting rid of toxic debt, and then build your nest egg by investing very aggressively when you’re young.
When you start approaching your early retirement, there’s nothing wrong with paying off more loans and freeing up some cashflow, but for most youngsters I wouldn’t bother paying early on <2% mortgages.