push cell magic to the head of the transformer line

I'm not 100% sure this is the right fix (ping @takluyver for review), since it is unclear to me what the physical/logical distinction is.

but this does allow the cell magic transform to preempt all other transforms.

Possible alternative: put cell magic at the end of the physical line, which would enable a single use case: copy/paste of cell magic to the terminal with prompts.

closes #3604