Have you had phantom locking/unlocking when you've driven it? eg all locks locking/unlocking?
If you've had ANY random locking or unlocking and you have a refurb latch to fit, then I'd do that first and go from there.
Tailgate unlocks by grounding through the CDL switch in the drivers latch. If that is iffy, then it could be making a connection when it shouldn't/or not connecting when it should.
Locking/unlocking just the rear doors is a strange one - but again if the tailgate is triggering through the microswitch in the latch and the switch is iffy, then it could be triggering the BECM to think the door has been locked/unlocked and then triggering the other doors to lock/unlock. Though I don't get why it isn't doing the passenger door aswell. Does the passenger door usually lock/unlock with the rest of them on the key/fob? usually one door not locking/unlocking is a sign of a bad CDL motor - but if it does work when normal locking/unlocking, then it's a bit strange.
Either way - you have a refurb latch... FIT IT. The number of people I've reset BECMs and the likes for who have said that it's come out of the blue and 'stupid car' etc etc and then in the next breath gone 'first the central locking was playing up and doing weird things and now this'.... heed the warning signs.
Also worth checking the switch contacts in the tailgate button as mentioned, as they can go bad.
If you have green connectors in the footwells, cut them out and solder the wires together and heatshrink them. The door wires don't go through these connectors, but loads of other things do, and that can cause all sorts of weird and wonderful things to happen when they get really bad.