An interesting problem, and probably quite infuriating! Some questions for you…
- Has it been wet recently? If so try drying everything out thoroughly first – an easy thing to do first up.
- Pull fuse number 6 (dash and immobiliser). Does it still do it (with ignition off – immobiliser won’t work with this fuse out)?
- Replace fuse 6 and pull fuse 1 (brake lights, horn etc.) Does it still do it?
- Can you start the bike without the keys in the ignition?
- Is your battery producing at least 12.5V with the engine not running?
Below are some things I’d maybe try/think about, but sitting here, I’m afraid it’s all guesswork, but it may help. Try the simple stuff first - the wet/damp, obvious visual wiring issues, poor connections, shorts etc. and do the fuse tests and the battery voltage test.
Guess 1:
Low battery voltages can cause funny electrical gremlins. It’s easy to check, so start with this one. Also check both terminals are good and tight – the battery might read 12.5V, but a loose connection can mean substantially less getting through into the loom.
Guess 2:
A faulty ground (earth) can cause bizarre things to happen between normally independent circuits. A circuit with a poor earth may well “borrow” an earth, or earth itself through another circuit.
A good way to check for shorts, bridged circuits and other funny things going on is to disconnect the battery and connect a multimeter (set to read resistance) between the negative and positive battery leads. Disconnect connectors from each suspect circuit in the loom one at a time and look for erratic resistance readings.
Guess 3:
If you can start it without the key, then there is almost certainly a short between the brake light +12V feed and the ignition switch switched output somewhere in the loom. What probably happens is when you operate the brakes the bulk of the current shoots off towards the brake lights and the leakage (short) to the ignition circuit is reduced, probably still there, but not enough to illuminate the dash.
Guess 4:
Sticky ignition relay and/or failed internal diode. If the ignition relay has pitted contacts they can stick in the on position allowing a small amount of current to flow, which arcs and pushes the contacts apart momentarily breaking the connection and they stick again, so it produces an oscillation. If a flyback diode has gone in the relay then it will allow current to leak back the wrong way through the from the relay’s inductor.