When something melts, its because the connection was damaged or weak, or too much current was drawn through it.
Too much current could be overwattage bulbs (unlikely in this case) or a short.
The damage here is on L1 wire terminal - and was due to higher wattage headlights (than the original 6012 bulbs) plus probably some oxidation and aging.
View attachment 1716206424
The little metal barb on the back of the teminal has to catch on the plastic. Otherwise the terminal backs out when the connector is attached.
View attachment 1716206441