How to make pistons push back minecart tracks?

As far as I understand your question, you have trouble with the track going trough the door...

Here is a screenshot of my setup, first you switch over to the new track, then you go trough the 'door', but by going down under the door block the track doesnt break and just creates a slope whenever the door is open, this would work in both directions.

Overview

Track under the door

Also as often happens with these timed things, the doors or track switcher might not stay open long enough, here is a way to lengthen that. (This is my own design, not all that compact, but the only thing that makes sense and works for me)

Time span


Tracks can be pulled by sticky pistons. Depending on your design, you may be able to have the sticky piston operate on the track rather than the block the track sits on. (Sadly, you can't move both the block and the track, even if the pistons fire simultaneously — the track will still pop off.)

animated example