Simulating the onset of grazing envelope evolution of binary stars