[modutils] fix support for extend_path based namespace package when module is nested in a sub-package. Closes #177651 [applied]