My mother has early onset dementia. Her habits were very healthy for 30+ years (quit drinking, quit smoking, daily exercise, lifetime healthy BMI, moderate diet) and otherwise physically she is in extremely good shape for her age. But one of the early, subtle signs of her cognitive decline was a reluctance to cook real meals. She now has progressed to a state where she can still use a smartphone or laptop for basic tasks, but isn't able to cook any sort of complex recipe from scratch, even one she previously did from memory. Seems pretty obvious to me that it's just as likely that cognitive decline causes an inability in older adults to plan and cook healthy meals, not the other way around.