Stability of the low-temperature tetragonal phase in La2−xBaxCuO4 and related compounds