If I am remembering correctly, the action that happens when the arrow first collides with the button presses the button. Therefore, when you replace the button, the arrow does not collide with the button as the tip does not touch the exterior of the button's hitbox.
It might have gone into the nether if it tried to loyalty back to you. Might want to check there. Another suggestion, don't throw a loyalty trident while moving between dimensions. That is like asking for it to glitch out and disappear.
If I am remembering correctly, the action that happens when the arrow first collides with the button presses the button. Therefore, when you replace the button, the arrow does not collide with the button as the tip does not touch the exterior of the button's hitbox.