They can't live in soil that's got what they need because the nutrients burn the plants' roots. They got so specialized for nutrient-poor bogs that they can't live anywhere else.
Sounds like they mostly exist miles deep in the ocean, where tiny scavengers are a more stable food supply. So like carnivorous plants, they evolved carnivory because they lacked alternative sources of nutrients.
According to series animator Vincent Waller, "there is absolutely no meat in the Krabby Patty. There's no animal product in there", something which was always planned by series creator Stephen Hillenburg.[9]
...
he stated that there is no meat served in Bikini Bottom except at the Chum Bucket.