2031 is in 5 years. There will be plenty of seniors even if the influx of juniors is exactly 0. Not saying 0 influx of juniors is good, it harms young people. But it wont cause lack of seniors issue in 2031.
Programming, at least for me, isn't like some factory job where you can't wait to get out at your 30 years or whatever. I've always enjoyed what I do and found it rewarding.