No, there isn't such a restriction. The endpoints could even be in different sites: Netbox will still let you add a direct cable between them.
The important point here is that a physical RJ45 connector is represented by different objects in Netbox, depending on its function.
* "Interface" is an active network port (e.g. on a switch or router)
* "Front port" and "Rear port" are passive pass-through connections (e.g. on a patch panel). One rear port can serve multiple front ports, e.g. for an MPO cable or a CAT5 bundle
* "Console port" and "Console server port" are active serial port connections; they can also be connected via patch panels
The other types of port are "Power port" and "Power outlet". Those can be linked together within a device, similar to how rear ports and front ports are linked, in order to model PDUs, distribution boards etc; and you can run a cable from a power outlet to a power port.