This could explain what is happening to your view controllers:
If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack.
(source)
This means that if you present view controller A, then view controller B, then call dismiss on view controller B, both view controllers are dismissed (although only B with an animation).
If you want to manage two different hierarchies of view controllers, you could use a second navigation controller. That means, e.g., that you would present a new navigation controller instead of view controller A, and make view controller A the navigation controller's root controller. Then you would push/pop any other required view controller (B, etc.)