Yeah, I figured you might know what a state machine is as they are pretty common in games. Only recently have they started to make their way into web development. They are incredibly useful for UI controls. I really like how Angular uses them for animations. You define them kind of like arrow functions. I had a cool demo over here, but the site it was on is no longer up.
Each button could have its own state machine, and those could be children of a state machine for the menu. So it would be a hierarchy of machines.
As an example, here's a traffic signal. The red light has a machine for a pedestrian crosswalk.
http://davidkpiano.github.io/xstate/docs/#/examples/light
I honestly don't know what should have priority in your demo. I generally don't like hover animations that involve moving something around. Not that they look bad, but it can be confusing when using a computer with a touch screen. Your example works because the arrow moves to the button with a focus, but a lot of people don't consider that, so sometimes you'll see an element just sitting there that doesn't do anything. That said, I would probably go with 3 different effects.