To clarify for the OP,
Worry less about this career existing in 30 or 40 years, worry more that there are many more pilots available than positions.
And why I say many, think in terms of 10-20 times as many pilots as there are airline positions.
Get a degree in something you love, AND pursue a flight career. That way, if it turns out you're a fabulous engineer or programmer or accountant, you can fly on the weekends and it will always be fun.