Circuit Complexity through phase transitions: consequences in quantum state preparation