A tight lid or removing the trash to outside is a good idea. Years ago, a friend’s dog fished an avocado pit out of her kitchen trash. I wouldn’t think that would have any appeal (slimy, flavorless) but when told to drop it, she defiantly swallowed it. The vet told them this required surgery or it could kill her. So at a time when money was tight, they had to spend hundreds of dollars but all went well and the dog lived many more years.
I saw a cartoon where the cat is complaining, “She bought a case of my favorite food. That means I can never eat it again.”