When you click button in the dialog, it calls callback function. As you can see, callback is a copy of SellAllJunk function. Dialog was defined before you have redefined SellAllJunk and it means that callback is a copy of the original function.
To make it work just update callback function after SeallAllJunk is redefined.
Lua Code:
local OrigSellAllJunk = SellAllJunk
function SellAllJunk()
d("SellAllJunk")
end
ESO_Dialogs.SELL_ALL_JUNK.buttons[1].callback = SellAllJunk
Just a note:
If you assign vairable1 = variable2, you always creating a copy of the variable's value. This is true for, numbers, strings, ... and even for functions. There are only two exceptions - "table" and "userdata". It is because those two types of variables does not hold the value but reference (or pointer) to the object in memory. So if you assign table1 = table2, you are copying just reference to the object, not object itself.