Fix build system to use module maps

Fixes #18102.