While a fence might _appear_ to be a 2d thing, it is really a fat line, rather like a ribbon. The height of the fence serves to provide evidence of division.
The height of the fence is in no way dependent on the area to enclose, so it really is a latrous affair - that is, line-like-shaped. The reality is that the fence divides ground. The height of the fence is a measure of how the division ought be seen, while the length (alone) is related to the area to enclose.
The fence, then provides a "surface" to the ground enclosed, and so in higher dimensions too: the surface of a portion of ground in Nd, is then N-2 d, because the ground is N-1d, and the division is N-2.
The actual crossection can be a solid square, for what it matters.