In the instance of cow vs dog or horse, it’s only cognitively dissonant if you try to reduce it to a context-free universal truth.
With context, it’s simply “we should not eat animals we keep as pets”, where “we” needs to be contextualized to the person and culture. I keep dogs as pets, and therefore should not eat them. Other people don’t keep dogs as pets and are free to eat them.
More generally, we shouldn’t kill things we love. Pets are loved, and shouldn’t be killed for food. Farmed animals are a means to an end, not an object of affection.
Other contexts apply too, for the pedantic. Starvation is a context that would make eating pets okay, so on and so forth.
A lot of morality is contextual. If a good friend is going through a break up, I should care and be supportive. If a stranger like Taylor Swift is going through a break up, I have no moral obligation to care or be supportive (though it would be kind to do so anyways). Morality is contextualized by my relationship to that person.