Anecdotally, my grandfather is 92 or so and still works as a journalist (reduced hours). He is still super sharp and does yoga every day. Blows my mind.
My Dad is 98, retired when he was about 80. He is still very sharp mentally, but has taken on hobbies like video production and 3D animation. Hopefully hobbies count towards brain health.
There's nothing special about a job! If anything, I'd believe that someone who had the drive to do challenging activities on their own (and engage socially with others) is doing more for their mind and body than someone clocking in and out at a boring job.