This is a joke passed on in the family of my informant, and dates back to his grandfather. It plays on the saying “an apple a day keeps the doctor away”. His father would have a cookie for breakfast every day, saying that he didn’t need a doctor or an apple and that he would rather have a cookie. He died in his fifties from heart complications.
This has now become a joke in their family; every time someone feels ill, a family member would recommend that the person start eating cookies for breakfast, and gave rise to the adapted saying in their family that “a cookie a day keeps the doctor away”.