Strip out non-public modules

Modules don't actually inherit privacy, so anything other than Public should be considered private.

Fixes #12801