There can't be more than 8 castles on the map. The Elves have 2. If the Necropolis has 4 on the surface, they have 2 in the dungeon. I was debating between 2 and 3. I think it's definitely 2. It certainly can't be less.
There can be more than 8 castles on the map if they are placed, but you can't generate them using the map editor (for example, look at the map from the 5th stage of the campaign).
offtopic