Brake cables and gear cables generally have different dimensions, and end stops, so they aren't interchangeable.
The cable housings look similar but on modern derailleur drivetrains they have to meet quite different specifications. Way back in the day (1970s) the housings were the same - there was only one type of cable housing - well, two if you include 3spd gear cable housing. The development of indexed gear shifting was the turning point that led to two different cable housings.
Brake cable housings need to be very strong against compression. Spiral wound steel housing is ideal for this purpose, and flexible to boot. However indexed shifting demanded very rigid, non-compressible housing. It does not need to withstand higher loads (like brake housing must). So a twisted housing comprised of longitudinal strands gives the non-compressibiltiy, but is not so strong overall.
A gear housing used for brakes will work OK. Until it eventually blows out under full braking and you have instant brake failure. A brake housing used for gear work will not give reliable shifting - you will constantly lose shifting accuracy and miss-shift all over the place.
Horses for courses.
None of this is an issue if you are talking about the Rohloff - the gear housings are plain spiral-wound housing same as for brakes.