I don't think it's so black and white. Past a certain point playing chess isn't going to help you with anything besides chess. But I think games can serve as an introductory tool - for example a game isn't going to teach you to be a SWE, but it can provide a more approachable way to gain some initial familiarity with programming ideas.
Is a game the best way to learn or stay mentally sharp? Not when taken at face value, but after a long day of work most people can't sustain something like taking an online course. Playing games can be a good way to stay mentally active when the likely alternative is watching TV or browsing Reddit every night. You'll find studies on cognitive effects of gaming are highly dependent on the games used and the control conditions they were being compared to.