Had this happen shortly after I bought the '19 F-250. The resolution for me was to find every connector under the bed of the truck related to the trailer plug wiring, open it up and fill it with dielectric grease. Also filled the 7-pin connector. No further problem in the ~2 years since I did that. Apparently moisture can get into the connections and causes the random disconnect events.
TT: 2019 ORV Timber Ridge 23DBS, Blue Ox SwayPro 15K/1500
TV: 2019 Ford F-250 XLT SuperCab LB, 6.2L, 4.30/e-locker, 4x4, 164" WB, 3216 payload
TV: 2014 RAM 1500 Big Horn CC (Traded in)
TT: 2015 Jay Flight SLX 195RB Baja Edition, Andersen No-Sway (Traded in)