The ND framework is using the MapStructure framework for creating custom NDs -however, the MapStructure framework is not specific to any single use-case or aircraft, it can also be used for different purposes, such as the map-canvas.xml dialog:
wiki.flightgear.org/Canvas_MapStructure
Internally, the back-end code here is using MapStructure, which -in turn- is using Nasal/Canvas and a few abstraction layers for performance purposes, such as the concept of a SymbolCache and helpers for things like animations and event handling (think timers/listeners).
The key thing to take away from this is that the way the ND/MapStruct ure code is structured, it is fairly accessible and even simple, e.g. the ND stuff is completely aircraft agnostic, and can be easily customized/styled and even adapted to completely different aircraft, while still using much of the original back-end logic for common stuff (mapping/charts, symbols, caching, animations).
In addition, both frameworks are designed to be "modular", which means that there is not just a single monolithic file with all code, but separate files for different purposes, that can be easily updated/maintained and customized. For instance, MapStructure is using the notion of "layers" for different navaids/purposes: http://wiki.flightgear.org/Canvas_MapStructure_Layers
Note that this stuff is designed to be reusable "as is", without ANY copy&paste required - i.e. it's using OOP, while still being accessible. Which also means, that it is trivial to run multiple INDEPENDENT instances of an aircraft/map at the same time, without any conflicts. Equally, this stuff is losely-coupled using the concept of "drivers" for its I/O, so that different aircraft/properties can be used to update an instrument - which means, that a Canvas ND can even be hooked up to an MP tanker or even to bombable aircraft (ai bots), all without any major coding required.
As has been mentioned previously, the key thing here is thinking in terms of building blocks and frameworks - there is no reason why the ND code couldn't be generalized a little more to also create PFD or other MFD instruments in a similarly generic fashion.