Planelike minimizers of nonlocal Ginzburg-Landau energies and fractional perimeters in periodic media