Enhancement of thermoelectric performance in rare earth-doped Sr3Ti2O7 by symmetry restoration of TiO6 octahedra