You have two forces working here: initial conditions and training.
Regarding training: in the end, we don't really care which of the two hidden-layer perceptrons become that near-vertical line in your second figure and which becomes the near-horizontal line - as long as convergence does happen.
Regarding which of the two perceptrons become which of the two decision boundaries in question, that takes us to network initialization.
See these lecture slides from the University of Sterling directly addressing your question. From slide 13:
The gradient descent learning algorithm treats all the weights in the same way, so if we start them all off with the same values, all the hidden units will end up doing the same thing and the network will never learn properly.
addressing your question. Followed by
For that reason, we generally start off all the weights with small random values. Usually we take them from a flat distribution around zero [–wt, +wt], or from a Gaussian distribution around zero with standard deviation wt.
Proposing a solution which I'm pretty sure is very common practice for these kind of networks. More useful notes on initialization are given the same slide.
Generally, there's a lot of effort invested in deciding what to do at initialization. Keras has many options around initializing, for example.