I agree that you had a bad clutch switch, but for it to kill the engine doesn't add up as I understand the electrics. You can start the bike in neutral with the sidestand out, but as far as I know, the side stand switch kills the engine if you engage a gear regardless of whether the clutch is in or out.
So I would have suspected that the side stand switch would have been the culprit except for the conditions of shutdown being somewhat repeatable with temperature but not consistent.
Doesn't matter, but yours is just a puzzle I found interesting. One thing I learned as an EE is never to do more than one fix when diagnosing a problem...and if doesn't solve the problem...put it back the way it was and try the next thing (hard to do with crud in the throttle bodies). Also never discount a coincidence of two or more unconnected things broken.