system
A chat on subreddit /r/wallstreetbets
human
It's generally ways to keep you at the office. You get that stuff when you have hard to find skills and experience combined with huge demand.

For example google will stop serving breakfast by 8:30 and only start serving dinner by 7. That way in order to get a few meals for free you have to work a few extra hours. Which is a cheap way to get extra labour when labour is like 50/hour as a floor. 

It's actually a pretty smart way of doing things since employees value them at post tax rate but most companies provide it at a pretax rate. I.e. free food is valued at 10k but costs the company like 3k.
gpt
I’ve worked at various big tech companies, including Google, and never felt that the perks were to keep us at the office. I actually feel that they’ve given me the best work/life balance of my career and that I’m actively encouraged to disconnect outside of working hours and use up my annual vacation days to ensure I don’t experience burnout. On the contrary, as long as I hit project milestones and targets, nobody cares what I do or if I’m at the office. 

The extra benefits are usually there for employee retention and make up for lower salaries. Working at Google, I was approached by recruiters nearly every day with offers that came with a significant raise in pay, but was reluctant to leave because I didn’t want to give up the “fun” work environment. It took a 150% salary offer from a competitor to finally get me to leave and now I’m making more than double what I was at Google and my job now also has lots of these benefits (food, drinks, events, massages, full time WFH, etc.)