The airline profession is one of many professions a young individual can choose. The airline career has to compete with those alternative career choices and is losing. At present, a young person just starting out has to essentially run a gauntlet - PPL, CFI, Regional - to even have the chance of getting to somewhere that will simply pay them. God help you if you lose your medical, or your timing is off and you get to experience a lost decade, or your regional collapses and you have to go to another regional. There is a very significant chance you never get to a legacy or even a major.
Most other career paths have the earning potential entirely tired up in the individual and their skill level. A pilot's earning potential is heavily tied up in the aircraft they are flying - how productive they are - so if you can't get to that bigger aircraft you are SOL.
I am not surprised that the airline pilot profession is losing out in the competition for young people. As someone who essentially stumbled into the industry and found out I love it, I generally don't recommend it for kids who ask because there are just so many better options if you're 18 and can do anything. As rewarding as it can be I can't recommend the typical civilian route to the airlines.
Airlines need to remove the gauntlet that young people have to run if they want a career in this field.