Yep, if your reputation gets too bad with various none human groups, your on the edge of ruin.
Remember, the point in Kodp is not to conquer all your enemies (which you can't do anyway), but to live in peace, or at least comparative peace with everyone around you, trolls, elves etc included.
You can have a couple of enemies, like your ancestral enemy and maybe a feuding clan or two to pound on occasionally, but its wise to play as fairly as you can with everyone.
As to how to specifically avoid bad endings, well usually you don't get one without quite a bit of warning, so when someone turns up telling you slaughter is coming, time to start giving gifts and trying build some bridges before they burn.
hth.
With our dreaming and singing, Ceaseless and sorrowless we! The glory about us clinging Of the glorious futures we see,
Our souls with high music ringing; O men! It must ever be
That we dwell in our dreaming and singing, A little apart from ye. (Arthur O'Shaughnessy 1873.)