Evolution of a supergene that regulates a trans-species social polymorphism