Fix improper var rename
Rename context param in buildPackages
Split context creation into two phases

This allows for utilities such as module map generation to be run outside of the current build flows.