I had this happen to me. It was caused by a broken license plate bezel. There are two screws that hold the rear hatch lock cylinder to the plastic license plate bezel. The plastic tabs that hold the lock cylinder can break when the key is turned in the lock cylinder.
The broken bezel causes the rear hatch lock sensor to get confused. It doesn't know if the lock cylinder is in the locked position or the unlocked position. I called it ghost lock. The locks in my truck would randomly unlock and lock in rapid succession.
The solution was to access the inside of the rear hatch by removing the interior panel, it just pops off and pulls up. IIRC there was a plastic sheet I had to pull back. Then I removed the rear hatch lock cylinder and plugged the hole with a plastic plug from the hardware store. So, I no longer have a rear lock cylinder. However, the rear window and rear hatch lock still work from the driver controls.
Hope that makes sense. Unplug and remove the rear hatch lock cylinder, leave everything else hooked up. The ghost lock should go away.