I wouldn’t call it a restriction, but maybe an unwanted usage.
Modules containing parameters are initialized before they can be used.
E.g. conv and linear layers contain trainable parameters and you would create objects first:
conv = nn.Conv2d(3, 6, 3, 1, 1)
lin = nn.Linear(10, 10)

Later in your code you would then use these modules and feed an activation to them:
out_conv = conv(in_conv)
out_lin = lin(in_lin)

The common use case it to create these layers in the __init__ method of your custom module and use them in the forward.
However, you could of course create them outside of the __init__ and pass them to it or even pass them to the forward method.
The issue in your code is created, since you are recreating the modules in each forward pass, which will thus reset the parameters every time the forward pass is executed.
The nn tutorial might explain it in more detail.