The world has made it abundantly clear that there is no such thing as job security anymore. At least not in the traditional sense. It's one thing to get laid off from a startup where uncertainty is the norm, but people people get laid off from banks all the the time. BANKS.
I believe there are two options. One, get really really good at something and/or Two, learn to lead. Getting really good at something may ensure that you are one of the last ones they lay off and help you buy time to find the next gig. If you can demonstrate your exceptional abilities it may also separate you from the hordes of people trying to get a particular job. Being really good at something will still only get you so far, though. The margin of excellence separating you from your peers has to be so blatantly obvious before it amounts to much.
Learning to lead opens up doors far beyond a skill set. Recently, we were hiring for a manager position at a Breakout location (with a salary and bonus comparable to a similar bank position) and what we looked for was someone who could use their influence to carry out our mission, who could have tough conversations, who could rally our team together, who could empathize and care for our customers, who could manage day to day operations at a high level. It didn't matter where they went to college, what degree they earned or even if they went to college. Our priority was finding a leader.
The ratio of great leaders to good enough workers is incredibly low. It's a much harder path but there may actually be security for those who choose it. If all else fails, though, just get really good at interviewing. Managers, including myself, are a sucker for someone who's phenomenal in the interview.