Food ingredients can cause digestive upset
in susceptible cats, especially ingredients of corn, wheat, or soy. And, dry kibble may contribute to ongoing state of dehydration or constipation. If a cat then associates pain, cramps, or discomfort of pooping with their litterbox, they may seek other non-litterbox places to poop.
Also, for many reasons, sometimes adverse digestive reaction to a food can seem to happen suddenly, after cat formerly did OK on that food. Which is why diet often gets overlooked as foundation for pooping problems ... by both the owner, and, the vet.
In many cases, a gradual (NOT ABRUPT) transition to a grain-free wet diet will help cure the unwanted symptoms. And may result in better overall health, too.