I am happy to report (and touching every wooden object wthin reach as I do so) that since I replaced the XT's ignition switch it has run perfectly. Of course, the petrol filler key is the same as the ignition, so I am now carrying two keys round with me. One has a green marker ("unleaded") and one has a red one ("fire and sparks"), and of course most of my riding these days is after dark, so I have had to attach a small LED torch to the keyring as well, so I can see which is which.
I dismatled the old switch and, not only were the contacts filthy, but the spring that keeps the moving contacts touching the fixed contacts was as sloppy as an old sock. I'm surprised any electricity flowed through there at all. That annoying buzz from the headstock area at certain engine speeds has gone too, so maybe that was a symptom as well.
So, HERE'S HOPING that the problem is fixed.