That's a good one! Putting the headlights on would also turn on rear sidelights. Check all associated rear wiring particularly shared ground connections as it looks like issue is being caused by unintended electrical secondary paths.
Richard
2018 Roadster 3.7 1966 Land Rover S2a 88 2024 Royal Enfield Guerrilla 450 1945 Guzzi Airone