I'm choosing to leave a job in tech in academia after 15 years.
If I wanted to, I could stay here until I retire (in another 20+ years), barring the complete destruction of the university I work for.
The position I'm moving to is also in academia (this time public sector in the EU), and I'm given to understand that as long as I can make it through the probationary first year, so long as I keep doing a halfway decent job there I can stay there for as long as I want, too. (We will, of course, have to see how true that is!)
Job security does exist; you just have to be willing to leave the Silicon Valley bubble.