I do this alla time, it is a lazy man’s deboincing. Sprinkle a few 10 ms delays around in there and get on with the bigger problem.
Although here it does seem wrongly done even as a hack.
I am so lazy. Usually I just use an externally denounced pushbutton… so catch the press and hang until it goes unpressed.
.
a7