Switching input mapping contexts doesn't appear to be sequential. Is it to be expected?

I’m trying to use the same key on 2 actions which are mapped in 2 contexts. When the key is pressed (and consumed), it will remove 1 context and then add the other. There’s some code for the action in the other context. I thought it would only run after the next key press but that’s not the case. I needed to use a delay node between removing and adding.

Here’re the steps to try it out.

  1. Create an Input Action, ActionA (trigger by pressed)
  2. Create an Input Action, ActionB (trigger by pressed)
  3. Create an Input Mapping Context, ContextA mapping ActionA to G
  4. Create an Input Mapping Context, ContextB mapping ActionB to G
  5. Add ContextA to a blueprint
  6. Add an EnhancedInputAction ActionA node: remove ContextA and then add ContextB
  7. Add an EnhancedInputAction ActionB node: print a string
  8. Run the code and press G once

If switching contexts is properly ordered, the string in step 7 shouldn’t be printed. If a delay node of 5s is added between removing and adding context, the string is not printed. Is it intended?