The explanation is actually pretty simple:
The way the rep_exe code works is:
-store the current mouse mode when player hovers over btnIconInv, switch to pointer
-upon leaving the button, restore previous mode
Any time you want to open the inventory:
-mouse is moved over button, current mouse.Mode is stored in old_mode, mouse.Mode is changed to Pointer
-show_inventory changes mode to eModeInteract but switches graphic to Pointer, i.e. user doesn't notice the change
-user starts operating the inventory GUI, the mouse leaves btnIconInv in order to do so, and old_mode is restored
Now, if old mode was eModeInteract, nothing changes. But if old_mode was eModeWalkto, that's restored, per the instructions in rep_exe.
The solution is to disable the rep_ex instruction. Make sure that show_inventory is below the rep_exe and its variables, then add this line to it:
was_over_inventory_button = false;