I don't think this is exactly the problem - I made a new question with a function defined in JS, and it didn't pick up the reference. I think it's failing to clear the reference if you change the language of a function from JME to JS after evaluating it.
That fix was wrong: functions defined in JS should use the default findvars behaviour, to find variables used in their arguments, instead of always returning the empty list.
I don't think this is exactly the problem - I made a new question with a function defined in JS, and it didn't pick up the reference. I think it's failing to clear the reference if you change the language of a function from JME to JS after evaluating it.