On the second inner variations of Allen-Cahn type energies and applications to local minimizers