Most animals instinctively know which food is good for them and which isn't. Also a lot of animals are able to digest food humans are consider to be rotten.
Maybe for some kind of pets a preselection of food by a human is needed especially in case the animal can't select from a variety of food on their own.
My idea was that most animals are born with the instinct what kind of food ist good for them.
How do you know what food is eatable and what is digusting? Own experience? Being taught by other people?
I've never seen dogs that eat fruits or go for sweets in general.
But I know that a dog from a family in my neighborhood snapped and munched a big sausage... and needed a treatment from a veterinarian afterwards, mainly because of the salt and the spices in it.
But that was processed food for humans, not dog food, and the main ingredient was indeed meat.
The question was about bananas... and the probability that the're overripe is way higher than rotten.
Brownish peel is a sign for overripeness... but I guess there are a lot of people would call them rotten.
Otherwise I speak from my own experience and while there are animals who don't know what food is good for them, a lot of animals do know it.