There is no immediate relation between the molecule and the number of layers you need. The central region does however need to contain at minimum as many layers as the electrode (the electrode copy). Moreover, those atoms are no allowed to move in relaxations. Now, they are automatically constrained if you run the relaxation as a device system, but what seems to happen is that you have large forces on the atoms, which cause some atoms to move inside the region monitored by ATK (the electrode copy, which can't contain any other atoms either).
So, if you make the molecule larger or not (in Z, at least) will not have any influcence on the surfaces (only the repetitions in XY, in case it's larger in those directions).
The error will most likely go away if you add just one layer of Si on each surface.
Finally, it may be a good idea to do a pre-optimization of the system as periodic in Z. You can either try to set it "non-self-consistent" in the GUI, or extract the central region and constrain all the Si atoms. Then relax this, also the strain in Z, and use this to construct a new device (which you can relax or keep as it is, it should be an ok geometry to work with).