Anomalous optical phonons in FeTe chalcogenides: Spin state, magnetic order, and lattice anharmonicity