Isolate beginCreate/beginInsert plan rewriting logic

It's currently embedded in DistributedLogicalPlanner. This commit
moves it to a separate optimizer in preparation for making the distributed
planner just another optimizer, too.

The current implementation is a big hack that we need to fix eventually.
This logic should be invoked on query start, not during planning. At
that point, the token returned by beginCreate/beginInsert should be
handed down to tasks in a mapping separate from the plan that links
plan nodes to the corresponding token.