350 starter solenoid

My custom 67 chevy c-10 truck 350 solenoid engaged while driving. Starter burned out before I could disconnect the battery. I replaced starter and solenoid as well as ignition switch. Now with switch in off position the solenoid/starter turn on when I attempt to attach hot wire back to the battery. I attached wires back exactly as they were. Wires only attached to large terminal and S terminal on the solenoid. What could the problem be?

The wire to the S terminal has likely melted into the main hot lead near the starter. You must separate all the wires and inspect the insulation.

How far should I trace the wires back?

From the starter to the ignition switch.