Of all the things that could derail worldwide aviation for pilots or even just one major in the next 20 years, I wouldn't put pilotless commercial airplane's in any of the top ten.
Yeah, it could happen, I guess.
But I've seen enough much more comparatively mundane things (*) bury pilots careers en masse over the last 30 years ago that weren't half as "sexy" as an AI operated airplane to spend any time worrying about it.
Besides, if AI gets good enough to behave just as intelligently, or slightly more intelligently, than your average human, it's going to be worldwide mass unemployment. Or a Golden Age, if you think the Bezos and Gates of the world want to share the wealth.
----------------------
(*) - Like wars, recessions, high fuel prices, bad CEO bets, terrorist actions, pandemics, inflation, overreaching unions, ultra low cost competitor startups, regulatory changes, etc...