On the development and generalizations of Allen–Cahn and Stefan equations within a thermodynamic framework