just following up on this, I eventually found the connector hidden up behind the front left shock, it was zip-tied out of sight. after cutting the zip-tie I was able to use the wiring diagram and service manual to check continuity of all the wires to the ECU from the wiring harness and check operation of the two switches inside the brake switch sensor, everything checked out just fine...
I added a bit of Permatex 22058 Dielectric Tune-Up Grease to the connector pins, re-assembed and re-zip-tied, used an app to reset the engine fault codes and have been on a few long bumpy off-road rides and the code hasn't re-appeared.
In the mean time I ordered a replacement brake switch as it's not too expensive and will replace it if the problem re-occurs. Part number is 5HY0-080010 -
https://www.aliexpress.com/item/1005005933963330.htmlnotes from my checking at the time, from a month or so ago, including wire-color codes, follows:
Brake switch connector, unplugged:
top two pins, furthest from clip.
GY+GY -> G/Y (0v ignition, B/Br (12v ignition)
open circuit when pedal out.
0ohm when brake pedal in.
bottom two pins, nearest clip
B+B -> G/P, O/R (0v ignition, 12v ignition)
6-10Mohm when pedal out.
0ohm when pedal in.
plugged in, ignition on.
G/P
11V when brake pedal out
0V when brake pedal in
Hope this helps others.