Electron mechanism for the structural phase transitions in La2−xBaxCuO4