From the doc:

When the name variable is of the form package.module, normally, the top-level package (the name up till the first dot) is returned, not the module named by name.

Hence this stupid loop, there might be a clever way to do it.