I can share my extreme croco-rule which helps me to speak, but I'm pretty sure it's not always correct. This rule is used in cases where the ordinary meanings of "the" (= that, those) and "a" (= one) are not obvious.

If you can use "my, his/her, our, their" before the noun
----> use "the"
else if the noun is in a singular form
----> use "a"
otherwise,
----> don't use anything.
end if

So, you have: "they’d all made a big mistake in coming down from their trees in the first place"
Hence, use "the".