There are risks, yes, but fundamentally we are still an industry that has a lot of upside, vs many others. In a recession many businesses will contract, but it's a rare large tech company that will do more than pause some forms of spending. Even when you hear that hiring is paused at the big tech companies, they will usually still be backfilling departures, and they won't be doing significant layoffs. The exceptions are companies with large service-based businesses that may or not qualify as tech companies based on your definition.
I work at one of those two ad-supported businesses, and would be very surprised if there are large scale layoffs.
And yes, as one of the responders noted, I meant the services companies. An IBM might do a large layoff, but I generally wouldn't put that in the same category as Amazon or Netflix. I've worked through three economic cycles now (at least I think we're seeing the end of the third) and while they haven't been great for everyone in the industry, we've been better off than most others. For instance, just to pick on one profession, I know way more lawyers who've become software engineers than vice versa.
I think they were referring to companies like Accenture, IBM, or PwC. The "Professional Services" industry employs a ton of software developers and is fairly pro-cyclical.