When they first added tracks I made a funky set of track switches that would let you go clockwise or counter clockwise around a weird shaped chunk of the underground. There were a couple parts that were mostly vertical so they required a lot of angle tracks with bouncer ends to keep you moving but getting that to work in both directions was tricky. (Forgive my lousy paint drawings, I can't access the game for proper assets right now...)
So as you can see you basically have 5 junctions to manage but they can be static once set up and they work pretty nicely. You have to hammer them like this:
- Top Left: straight track up top, allows traffic coming up to join the rail and head left.
- Top Right: angle down, traffic coming from the right, headed left will go down.
- Bottom Left: straight track at the bottom, allows traffic coming from up top to join the flat rail and head left.
- Bottom Right: angle up, traffic coming from the right, headed left, will go up.
With a logic gate you could do the same thing with pressure plates as a wire on a junction will changes it's function.
If you hold a direction, (up or down,) you can force your minecart to go on a track that intersects but isn't the default direction for you to go, is it possible you're holding a key and causing the weird behavior? Also, which specific junction was causing you grief, have you narrowed it down?
I think I saw a junction or two where the angle track goes behind the horizontal track, those spots tend to work where you'll end up following the track in front. You may need to hammer the junctions a bit more to give the angle tracks priority. The one I'm looking at is the left most track headed like this: /