[package] fix orderedimporter dummy package check (#72533)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72533
The current check that we have for dummy packages is too expansive; it
will skip anything without a `__file__`, including extension modules in
the standard library.
So first check if a module was created by torch.package before skipping
it, which should rule out anything accidentally getting skipped (as the
only time torch.package creates something without a `__file__` is the
dummy case).
Test Plan: Imported from OSS
Reviewed By: PaliC
Differential Revision: D34082792
Pulled By: suo
fbshipit-source-id: 18b17eb0f693927697657b20843ec5cd8bcccb47
(cherry picked from commit f571370078f7e12afa46ba4b2f6be2d96efce93b)