Interesting discussion. As the future of work continues to evolve, the secret of long term employment with one company has remained fairly static - execute or be executed, add value, build relationships, do what the majority won't/be flexible and be aware of your limitations.
I have worked for the same company for 37 years (50+ billion dollar/year business) in various roles and have seen lots let go over the years (just laid off 500+ in late October out of a workforce of over 175,000+). People swept up in this last round were let go for 4 reasons - redundancy, poor performance/poor choice, technology/outsource, or over compensation.
The first three reasons are usually early/mid career disruptions, ie - hired to implement/train new process, once completed - the job ends. You will be at risk so be aware and ensure you also provide other value - most organizations will find a fit elsewhere. The last reason is usually a late career disruption as you move up the ladder in title and pay/compensation. At some point the business will assess it's return on investment and if you are not as committed as you once were (normal course of action as priorities shift to kids and social engagements that start to take precedence over our jobs) and are blocking younger talent, you are at risk. Just as your path was being blocked by someone else earlier in you career. It sucks but it is business. Usually, in our business at least, when you get to this point you should be very well set up for the rest of your life as long as you realized that this is the end game and prepared yourself accordingly.
I have always approached my job with the understanding that when I get paid the business has met it's short term obligations to me. It is up to me to continue to give them reasons to keep paying me.