It’s hard to diagnose over the internet, but I would double check my negative battery terminal ground to the frame and all the way to the body panels where my ground wires are attached. You should have grounding straps attached to the frame on any panel that your grounding to, don’t rely on panel fasteners to supply the ground. Use a voltage tester or light on attachment points. since the issue shows up when you turn the headlights on, headlight wires need to be chased as well, in fact that’s your primary suspect.
I’m not sure, are headlights grounded at the corre support or at the fuse box?
Edit: headlights ground at the core support. Is your headlight switch grounded? If so how is the cab grounded?