The headlamp assembly has all of the wiring, sockets, and bulbs in place before it is installed onto the vehicle.
The way the car is designed is that there is a metal bracket/support that the headlamp assembly effectively sits against when it is installed. The wire for the marker/signal socket is effectively pinched between this support and the headlamp assembly.
You would want to remove the nuts/bolts that hold the headlamp assembly to the vehicle so that you can move the socket/wire through/between the assembly and support so that the socket/wire can now go over/inside the support/vehicle and then back into the opening in the assembly.
This is the fix.
The same goes for the tail-lamps. The wiring is in place and is effectively pinched between the lamp and the vehicle.
This is the quick-and-easy way for the factory to assemble the lamps to the vehicle. Otherwise, the lamps would not have any wiring/sockets on them and would be installed 'naked'. Then when being installed to the vehicle, the assembly-person would then have to insert the correct socket/connector position from the car into the lamp. If this were the way it was done, then there would be no pinching of the wires, but it takes more time to do so.