If replay cache is enabled and available, replay is already cached after you finish stepping in edit mode so rewinding shouldn't be needed.
replay_rewind() generally doesn't cache anything on its own, its behavior is essentially the same as pressing R hotkey. In your case the part that is actually doing the trick are the toggle_game_pause() calls that'd step the replay until the end.