Correct stub undefined parent modules all the way down when stubbing a nested
constant.

This is necessary for verifying doubles to work correctly, since they
need to distinguish between real and stubbed constants.

Fixes #529.