I don't mean the Elven-king's blueprints, I mean Tolkien's mental blueprints.
Castles and other large stone buildings are built on foundations that go deep
into the ground, and so dungeons (just buried chambers between the foundation
walls, really) are a universal feature in large medieval stone structures.
I think Tolkien could not imagine a king's stronghold that was not based on a
castle or great hall, and simply provided dungeons for the dwarves (as many as
needed for the story) out of both the infinite resources of a magic structure,
and the infinite variations of stories about captives in castles.
Of course, many of the other speculations posted here are good, too.
I like Curious' clever perception that, in theory, dungeons seem to be
unnecessary!
The crisp, clear prose of J.R.R.Tolkien sings out to the reader:"Within these general applications the following relations were also commonly observed. The normal letters, Grade 1, were applied to the 'voiceless stops': t, p, k, etc. The doubling of the bow indicated the addition of 'voice': thus if 1, 2, 3, 4 = t, p, ch, k (or t, p, k, kw), then 5, 6, 7, 8 = d, b, j, g (or d, b, g, gw). The raising of the stem indicated the opening of the consonant to a 'spirant': thus assuming the above values for Grade 1, Grade 3 (9-12) =th, f, sh, ch (or th, f, kh, khw/hw), and Grade 4 (13-16) =dh, v, zh, gh (or dh, v, gh, ghw/w)."