cxxmodules: detect and message about non-compiled sources

Previously an internal error was raised which ended up causing an
internal exception to be thrown. This is a typo situation that should
fall into an explicit error.

Fixes: #25207
8 files changed