>>1253485There is a switch that senses if the door is open or not. You might need to remove it. Other option is the "security box" nightmare. Basically it's the vehicles anti theft system, but sometimes they go hay wire and do weird things. They can't be removed because all the ignition systems run through them and Ford doesn't release any specs on them because they don't want people to disable them and steal the vehicle.
My advice would be to repeat your experiment and try locking the truck with the key fob. Controlling the system manually by removing the switches might be your best bet. You might also go full bubba and put a big battery cutoff switch if nothing else works, just make sure it can handle the load.