That's a good fix.
It's actually a problem the HD had with the models equipped with 5" headlamps for a while.
Those small buckets heat up quite a bit especially if the connector isn't very tight onto the back of the bulb. Another recommendation is to go with a high temperature connector if one wants to retain the pluggability.
This is a good one. Get the crimp and soldered one.
As for mounting a switch in the housing, it's best to put it somewhere else. But if you must, then use a good quality, heavy duty switch with a phenolic body.
Also use good wire. I typically use the kind with PTFE insulation that's rated above 200 degrees.