move patch hook to loader instantiation time

This hook needs to happen earlier if we want to capture all the work
that loader does when it is instantiated.