I just checked four different bikes. On three of them, the rear brake cable housing is routed behind the front brake housing, i.e. between the front housing and the headtube.
For the one exception, the wing-type handlebar puts the front brake housing so close to the headtube that I ran the rear brake housing outside (in front of) the front housing.
Make the rear brake housing just long enough that you can just turn the handlebars fully to both sides without binding the housing.