Hand flapping on its own means nothing. What matters is when it comes and whether the child can stop it. With joy and excitement it is brief, the child can interrupt it when asked, and it fades with age. When it appears with stress or boredom, the child is unaware of it and it is hard to interrupt — that is self-stimulation, the way a nervous system adds or removes input for itself.
Self-stimulation is not a bad habit and there is no point in forbidding it — the child is regulating a state it has no other tool for. Forbid it and the body finds a substitute, often a less pleasant one. What helps is looking for the trigger: whether there is too much input and the child is defending against it, or too little and the child is topping it up.
The self-stimulation analysis covers four groups of behaviour — motor, sensory, metabolic and psychological — and shows which one dominates. From that you can tell whether it is a defence against input or a way of adding it, and choose what to do at home accordingly.