High-temperature elasticity and anharmonicity in layered thermoelectric materials