So I’m reviving this thread because I had a very similar issue just recently and the fix was simple so hopefully it’ll help you guys.
My ‘17 Sierra 3500 started with the door ajar issue, I tried slamming it, playing with the accordion wire harness in the door frame, I even took the door panel off and pulled apart all the connectors to see if there were loose or frayed wires or possible corrosion. Pulled out a multimeter and checked everything; all good. None of the above fixed my problem.
Then I started getting the “service trailer brake” and “trailer disconnected” randomly. Sometimes with a trailer attached, sometimes without. Seemed odd to me, but I didn’t even bother troubleshooting.
Next I started getting “Service Stabilitrak” randomly and sporadically.
Ok ok now I’m thinking WTF is going on here. So I disconnected both batteries and pulled every single fuse and reset it (checked to see if it was popped in the process). I didn’t even check to see which fuse I pulled, just pull, inspect, replace.
The length of the whole battery and fuse process took me about 2 beer, throwing a ball for the dog periodically, playing referee for two toddlers who love to fight and VIOLLA... the door ajar, trailer brake, and stabiltrak all fixed in one swoop.
Hope this helps the next guy.