I think about humans and rats, which found a niche in human agriculture and followed us everywhere. Why are rats, roaches, and other pests dominant (living off our success) rather than killed off? Not for lack of trying!
So the only difference you want is sentience. Would it still work if rats or roaches were intelligent?
A big issue, I think, is the size difference. If another life form was similar in size we'd call it war. Pests need to find rich environments in our incidental infrastructure.
It is reasonable that being clever is a benefit, to keep ahead of the host. If the host is intelligent so can eliminate niches, create traps, and otherwise counteract the parasite using brain power which is much faster than biological evolution.
Pests solve that in real life by evolving rapidly (germs) or fast enough (roaches), but for non-microbes a main property is hiding so any attempt to kill the population will miss some; and fecundity so will bounce back if only a few are left.
If fecundity was strongly selected against, cleverness might take its place. Rats are already smart in some ways, with social behavior and learning, but the layout of the brain is the Mammal, same as ours but much smaller.
A bird has a different brain structure and some birds are surprisingly intelligent for such a small size, and smarter than previously thought. Point is, very unrelated species means the brain can be more different, not similar to ours but too small.
It's also noted that hive insects are like an extended organism and lots of fiction posits intelligent ant hills, when individual ants are not. That brings me back to cockroaches: a distributed many-body creature could be intelligent with a long life and low reproductive rate, while the component bodies are quickly replaced, tiny, and specialized. But that does not physically evolve as the units are produced by the fixed organism, not descendants with variation.
We might not realize that the pests are intelligent! But a hive-being could live off our productivity and co-evolve with us, the whole time being a pest. Our continuous attempts to wipe it out would only drive its evolution toward being a better pest.
An interesting story might be the discovery of the intelligent hive, and coping with its world-view.