Fixes #8607 - remove unnecessary module dependency resolution

Module dependency resolution is not necessary and should be ensured by the module. From the previous fix I left ordering of the modules and reimplemented detection of loading disables modules as module deps.
Could you please add some tests for this function?