Have you tried pulling 1 fuse at a time to see if you can narrow down what circuit is causing the issue? Or unplugging 1 switch at a time to see if you are getting feedback thru a bad switch?
This is an okay way to do it, but I'd pull them all and start putting them back in one at a time until I found that naughty one.... in case it's more than one, but I think this is a relay issue.
I'm not too keen on the actual problem though. Everything works until you apply the either brake, then it goes off. I get that. Now, when you release the brake, does it go back on, or does it only go back on when you shut the bike off then turn it back on? In other words, how do you get it back on? When did this start happening?
, here is your wiring diagram
.... or at least it should be close.
Also does this occur with the key in run or only with the bike running, or both?