In the wild, animals may share waterholes, and grazing areas. Some animals have symbiotic relationships one example being the hippopotamus and the oxpecker bird.
The symbiotic relationships are based on needs; Hunger, shelter, safety.
Human beings, appear to be the only species that has relationships with other species for pleasure. Companion animals and horses for riding are two examples.
Of course, there is also the use of animals to meet the species needs; eg dogs for safety.
In this question I would like to focus on the relationship between human beings and other species as a source of pleasure (or comfort).
What is different within the human brain that allows humans to maintain relationships with other animals purely for pleasure, that is absent in other species?
According to Hal Herzog 2010's article "Are Humans the Only Animals That Keep Pets? Do monkeys keep pets?" in "Psychology Today", humans are the only animals that keep pets. Other animals have also kept pets however it was not under natural settings. These other "pet" relationships were observed in zoos, controlled experiments. etc.
One the main reasons Herzog notes that humans are the only animals to keep pets is the idea of culture. Humans have evolved to form a culture with social rules and norms. They can gather social information from others by relying on certain cultural rules. So it is acceptable for humans to form pet relationships with other animals. Some cultures do not have a word for pet. However ultimately these cultures end up forming relationships with animals that are "pet-like." The reason for this is because of memes. That is, the idea of having a pet spreads across different cultures.
having only examples of such relationships involving humans is a result of selection and reporting bias rather than of the lack of such relationships not involving humans (Herzog's argument boils down to "why don't chimps?", which states the lack of data to disprove his point rather than to data proving it, a clear case of reporting bias).
Somehow, I feel that the question is based on shaky assumptions:
That the "pets" relation is hierarchical in nature (with one member of the relation, typically the human, dominating the other, for instance a dog or a cat or a fish).
That we know of all symbiotic relations in "natural contexts" (when we mostly know about those in human culture, and only poorly those which do not involve humans.
That "escaping solitude" is a "need" (and pleasure) typical of humans, when it is likely to be one for any individual of any social species (as much as hiding from the sky for preys of birds of preys), in the sense that it was positively selected by the evolutionary mechanisms.
Basically, I feel (no offense meant!) that the question is a case of asking "why is it that objects A with characteristics B,C,D,E,F,...,Y always have property Z?". Concretely, if you define
A = pets" such as having characteristics such as
C=not (any more) for direct consumption (e.g. chicken),
D=not (any more) for help hunting (e.g. dogs),
E=not (any more) for help producing food (e.g. cows, goats,etc.),
F=not (any more) for help producing clothes (e.g. sheep, cows,etc.),
G=not (any more) for help keeping food safe from "vermin" (e.g. cats),
you will have made your definition so specific that, of course, only the cases you have in mind (human's "pets") match, and the coincidence should not be a surprise.
The very same Hal Herzog cited in another answer mentions the cases of
an American Sign Language-trained gorilla adopting a cat,
Hal Herzog excludes the first 3 examples as "unnatural settings" (a flaky argument) and the last one as "the exception that proves the rules", an even flakier argument "whose meaning is contested" (especially with the modern meaning of the verb "to prove": it would be correct to say that "the exception *tests the general rules", but then the general rule must be discarded if it cannot be modified to encompass even the exception).
Alternately, if one was to define A (to avoid the word "pet") as "interspecies symbiotic relations between two members of distinct social species", Hal Herzog himself is giving instances of A which do not involve humans directly, both in the human culture (e.g. a dog and a cat sleeping together, a parrot and a turtle playing together) and outside of it (e.g. birds of other species peacefully sharing living quarters with a social colony of monk parakeets, parrots and monkeys being adopted into a colony of parrots and monkeys of a distinct species).
As such, I would make the research hypothesis that any member of a social species (not just humans), being isolated from its peers, will be searching for company, including from individuals from other species, "for pleasure". I would be curious to know the state of the art on such topic from an Ethological perspective!