Welcome to 2CarPros.
The first thing that comes to mind is what is called a TNS relay. The TNS relay is powered by the taillight fuse and is energized when the headlight switch is turned on. Thus, when the lights are off, the relay isn't energized, but when on, it may be failing to allow power to the brake lights. See picture 1 for location. Also, check the fuses in picture 2.
Now, if the relay is bad, and please don't quote me, but I believe it is soldered in place. Once you get to the box, let me know exactly what you see. I am looking at schematics so it isn't clear. And don't laugh, but if it is soldered, turn the lights on and have a helper watch if the brake lights come on if you tap on the junction box. The relay could be stuck.
Here are a couple links that you may find helpful when checking fuses and basic electrical circuits. Also, if the relay is removable (and I have a feeling it isn't) here is a link that explains how to check a relay:
Check out the diagrams (Below). Please let us know what you find. We are interested to see what it is.
Images (Click to enlarge)
Monday, July 8th, 2019 AT 9:13 PM