Under normal circumstances, when switching between the main hand and the off hand, it is necessary to wait for the main hand to lift the tool. However, if the tools held by the main hand and the off hand are of the same type, they will not trigger a lift wait during the switch, but will immediately interact.
Just holding any two identical tools will cause this problem.
Mod edit: adding “item bob animation swap” to the description to improve this report’s discoverability.
This is WAI, this behavior is consistent with switching items in the hotbar too.