[3.6] bpo-30814: Fixed a race condition when import a submodule from a package. (GH-2580). (#2598)

(cherry picked from commit b4baacee1adc06edbe30ac7574d17a8cd168e2e0)
7 files changed