Hello and welcome to JustAnswer!
I see your question has been up for an extended time without a response, and while Nissan isn't my area of greatest expertise I would like to try to help.
Assuming the transmission was replaced with a known good unit then the problem could be with wiring or the module that controls the transmission. It will either be controlled by the powertrain control module (PCM) which also controls the engine, or it could be controlled by a dedicated transmission control module (TCM).
THe first step in diagnosing this problem is going to be using a scan tool or code reader to see what fault codes are setting. It sounds as if the transmission is going into a limp-in because the TCM or PCM is seeing a problem that it thinks could cause potential damage or it thinks it doesn't have complete control over the trans. It will set a fault code when this happens and that can be used as a starting point for diagnosis.
The problem could be a wiring issue between the trans and module. There are shift solenoids and sensors that are monitored and controlled by the module and an open or short on any of the wires will cause this.
If the module is failing internally or it is losing a power or ground feed and shutting down it will also cause this.
It's definitely possible that there could be a problem with the replacement trans also, whether it's a remanufactured or a used unit. It may have the same or a different issue as the original but is producing the same symptoms.