Handing OpenSCAD module parameters derived from other variables
This seems to be a limitation of the language. One workaround that's only moderately ugly is, in the body of the module:

mouth = is_undef(mouth) ? pin_radius * 0.9 : mouth;


etc. If you'll only be using the file via a use directive in other files, another approach is file-scope variables. These can be overridden when the module is called, just like module parameters, and they do not provide or take values for/from the calling file's file-scope variable namespace.