I wouldn't deem a person with dementia in that situation as an act of animal cruelty, I'd say that's the other persons fault and they deserve punishment.
I had to be hospitalised after doing something very bad (in hindsight) to myself because of my depression. My animals never suffered because of it. In fact, the first thing I said when I regained conciousness was "Is Chip okay". Chip was my dog, I didn't have guinea pigs at the time. Depression is no excuse for neglecting animals. She was concious and aware of her responsibilities, it's still her fault the animals were in the situation they were in.
So yes, in some cases, it's not entirely the person in questions fault. But I'd say that's a very small minority of the time. The bottom line is, if you're concious, mentally stable (in terms of awareness of your surroundings and responsibilities) and you allow an animal to suffer while in your care, you deserve everything you've got coming to you and more.