Thanks to rising employment costs, corporate restructuring and, above all, investment in AI, more and more men in their 40s and 50s are finding themselves out of work.