To bring it back to the question that spawned the ask: One thing to future proof a career as a SWE is to get into business and leadership/management as well as learning how to program. If you're indispensable to the business for other reasons, they'll keep you around.
in that case the conversation is still kind of missing the forest for the trees, yes your career will be safer if you get into management but thats not going to play for everyone. Mathematically, it cant, not every engineer can go be a manager. What Im interested in is the stories of the people who arent going to make it.