Puffer fish can't control being poisonous, but it still discourages predators.
Poor example, they're not naturally poisonous, it's dietary. Palytoxin and Ciguatoxin are not endogenous, the animal first has to eat another organism containing a dinoflagellate that creates these toxins, Gambierdiscus toxicus. This quality is inherent to most reef fish, especially ones with beaks.
Begging the question, nature or nutrition.
> Poor example, they're not naturally...
So...what if the vile-smelling feces of the sloths was not "natural", but due to a variety of microorganisms which had colonized their intestines?
Like tigers can't control their coat color or stripe pattern, but it has an evolutionary advantage so these traits persist.