Cats love taking dumps in good soil. It’s inviting to them when you added new clean soil to plant your vegetables and they love using it as a toilet.
There is a lot you can do to keep them away, but the most ‘cat friendly’ method is to use coffee ground. Cats don’t like how it smells and also don’t like how it feels. They will go looking for another place to use as a toilet for sure :)
Never trow away your coffee ground again, make sure you use it in your vegetable garden :)