Most all of the similar problems helped others with…ended up with the trailer wiring.
Most common was the harness to the drum brake.
2nd most is the routing and some trailer OEMs uses daisy-chain.
After unplugging & cleaning contacts & applying dia electric grease most were better.
Best has been to retire the trailer with dedicated runs from each wheel brake directly to a central point by the coupler.
If you go that route, increase the wire gauge and only use ringlugs…NEVER tap connectors (they were invented for telephone use…a static application)