why didn't it do a better job of it
Or in some cases why such a good job.
Consider Dracunuliasis or Guinea Worm.
404Error - seattlepi.comDracunculiasis - Wikipedia
A marvelously adapted .... errr ..... designed creature to a specific diabolical niche.
I am sure before the fall this creature was happily slurping up blue-green alge from ponds. After the fall the worm "micro-evolved" to its current wicked methods causing untold human and animal misery.
One consequence of buying into a intelligent designer is that they also have to consider that the designer may be wicked.