I figured out the issue! It seems that any module run through torch.jit.script gains the __iter__ attribute that one would expect in lists, tuples, tensors, etc…
print(hasattr(model.layer, "__iter__")) # False

jit_model = torch.jit.script(model)

print(hasattr(jit_model.layer, "__iter__")) # True