MOSFETs blowing up on BLDC motor controller upon battery connection
There's a lot amiss here. The TC4427 is only rated to 18V on the Vdd pin. You don't show what the Vd supply is set at, but it needs to be at the Vcc that is applied to the top FETs so that it can pull the gate up on the P channel FET to turn it off. Vcc with a 12s battery is going to be 40-45V...
 If Vdd is connected to Vcc, you'd then (assuming that the TC4427 hadn't failed) be applying the full 40+V to the gates - these are only good for 20V. You'd need to generate a high side gate drive supply at Vcc less a suitable drive voltage (10-15V).
   Lastly, and certainly not least, look at the body diodes on the output FETs - the high side one will always be conducting. The source and drain pins should be swapped.

I'd suggest looking up a reference design for a bridge and gate driver circuit. You can find ones that use drivers that don't need the inverters, have shoot-through protection (that prevent both FETs being on at the same time) and incorporate a bootstrap supply for the high side FET). Most use N channel only, since the Rds of the N channel FETs is a lot lower.