Maybe you splitting the original forward() method in two different ones breaks inheritence and/or autograd in some way?
Why do you need to split it in the first place? I think you could retrieve the midoutput result in the original forward by keeping an intermediate variable and returning it as well as the final output… Something like that:
def forward(x):
    x = self.layer1(x)
    midoutput = x
    x = self.layer2(x)
    return midoutput, x

and then:
midoutput, output = model(images)