I'm wondering though if anybody can fancy a guess as to why this happens?
Here's my guess, which has a high probability of being correct:
1. The game builds lists of all creatures, plants, and inorganics, sorted by the order in which they appear in the raws (and the names of the raw files themselves). If an entity is duplicated, the index of the
newest one gets used. These lists are then used as lookup tables.
2. Whenever a creature, plant, or inorganic is referenced by name, that name is converted into a numeric index using an appropriate table from step 1. However, the duplicate entities are deleted when you load the game. As a result, duplicate entities will cause everything after that entity to be shifted ahead.
Example:
Your creature raws contain definitions for [TOAD], [BEETLE, WORM], [DWARF, HUMAN, ELF, GOBLIN, TROLL], [FORGOTTEN_BEAST_1, FORGOTTEN_BEAST_2, FORGOTTEN_BEAST_3], etc. This results in a lookup table of TOAD=0, BEETLE=1, WORM=2, DWARF=3, HUMAN=4, ELF=5, GOBLIN=6, TROLL=7, FORGOTTEN_BEAST_1=8, FORGOTTEN_BEAST_2=9, FORGOTTEN_BEAST_3=10, etc.
You then duplicate the 2nd RAW file, adding duplicate entries for BEETLE and WORM. The lookup table is now TOAD=0, BEETLE=3, WORM=4, DWARF=5, HUMAN=6, ELF=7, GOBLIN=8, TROLL=9, FORGOTTEN_BEAST_1=10, FORGOTTEN_BEAST_2=11, FORGOTTEN_BEAST_3=12, but the actual creatures are still TOAD, BEETLE, WORM, DWARF, HUMAN, ELF, GOBLIN, TROLL, FORGOTTEN_BEAST_1, FORGOTTEN_BEAST_2, FORGOTTEN_BEAST_3, etc. because the duplicates got deleted.
Thus, you end up with mountainhalls populated by Elves (offset 5), villages populated by Goblins (offset 6), forest retreats populated by Trolls (offset 7), and dark fortresses populated by Forgotten Beasts (offset 8 ).