Self-organized nonlinear gratings for ultrafast nanophotonics