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.

This fell out quite nicely.

Fixes #529.

R @myronmarston @JonRowe