What has happened is that the electrical resistance across the switch unit became too high, and the unit heated up. The heating led to surface oxidation which further increased the resistance and, bingo, the whole thing melts. The power across a resistance of just 0.2 ohms at 8 amps is 12Watts, more than enough to melt it in a tight space.
It could be the unit was a dodgy quality, or it could have happened because one of the terminal wiring connections was done screwed down adequately. Change the switch for another good quality one and pay special attention to the way you stripback and make the terminal connections.