Ah, I think I get it. You mean your set the `[EB]OD-function` variables
to your two functions/commands, right?
Exactly.
To figure out whether the problem is inside `end-of-defun` or in the
way `[EB]OD-function` are expected to behave, you'll have to single-step
through `end-of-defun`, I think.
It seems that the problem originates from the function which `EOD-function' is set to be called after via the `BOD-raw'. With a positive argument all is good, since the navigation functions for bash-ts-mode have symmetric behavior -- both bring point to beginning/end of the closest function that encloses point.
However, with negative arguments that does not happen, as `sh-mode--treesit-beginning-of-defun' moves point to (beginning of) the closest sibling function (after point) and `sh-mode--treesit-end-of-defun' moves point to (end of) the closest sibling function (before point). In this case, the selected functions to which point move to are not the same.
A second look revealed that the function set to `end-of-defun-function' is called without arguments, thus when used can only produce motions that are symmetric to `beginning-of-defun-function'.
Since that is not the case for the functions I am proposing for bash-ts-mode, I believe that binding them as commands to C-M-a/e is the only option. Unless I am missing something.