I for one find this kind of cognitive dissonance extremely upsetting and a bit perplexing. People are easily able to compartmentalize their feelings about various animals. This leads to neat little groups - food, pet, science experiment. It's very frustrating to me.
If it's purely the compartmentalization that upsets you, then you'd be happier if people were totally cool about tossing the Frisbee around with their dog Spot on Saturday, then cooking him up for Sunday dinner. Is that the case?
Anyway, people are a mix of rationality and emotions. We build up emotional attachments to the animals we keep as pets, and get uneasy thinking about using them in meals or experiments.
I didn't say they were universally accepted groups. Those people who have pet rats likely do not want rats being experimented on. And those people who eat dogs probably don't keep them as beloved pets.