I had a 'good discussion' with some umpires once after a similar situation in a match where I was coaching.
The opener on about the 3rd ball of his innings played a clear leave (he had done so for every ball so far), raising his bat and watching it carry through to the wicky under his arm, then dropped his bat and took a step or 2 forward to poke at something on the pitch. The wicky immediately under-armed it at the stumps and he was given out by the square leg.
I asked afterwards what he was actually given out for and was told run out. Here was my conclusion from opening the rules app and trying to express my outrage to the umpires at least assuming I may get an apology.
20.1.1.1 it is finally settled in the hands of the wicket-keeper or of the bowler.
Clearly for the batsmen having not played a shot and having watched it carry through, in their mind it was "finally settled"? And in the context they were clearly not attempting a must-get run off a last ball? But who decides "finally settled" See law 20.2
20.1.2 The ball shall be considered to be dead when it is clear to the bowler's end umpire that the fielding side and both batsmen at the wicket have ceased to regard it as in play.
Again, in context the batsmen stepping out his crease was probably a good 2 seconds after the ball had hit the gloves and was clearly not attempting a run ...both batsmen had clearly regarded it as no longer in play and clearly assumed the wicky would have the same view of the situation (spirit of the game?) Yet did the bowlers end umpire agree ... nope ... See law 20.2
20.2 Ball finally settled Whether the ball is finally settled or not is a matter for the umpire alone to decide.
Ah .... so this is the only clear guidance on this all. It is all at the umpires discretion.
Moral of the story: I went back and told the guys that as a tough lesson you just don't leave your crease as you have very little way of knowing what an umpire will / won't decide. (A bit like my response to getting bad LBW calls ... make sure you get bat on ball so you are not at the mercy of human interpretation)