The first could be accomplished by editing the webwork2/htdocs/jsMath/jsMath-ww.js file and adding
Setup: { UserEvent: { "onload": function () {jsMath.Extension.Require("AMSmath")} } },after the line reading
Font: {},This would cause the AMSmath extension to be loaded for every problem for every class (but since the file should be cached by the browser, that is not such a big deal). I should add a variable in global.conf that gives an array of extensions to load automatically to make this easier for you.
To predefine \dfrac to autoload the AMSmath extension, add
dfrac: ['Extension','AMSmath'],after the line
boldsymbol: ['Macro','{\\bf #1}',1],This would define \dfrac so that it would load the AMSmath package only when \dfrac is actually used in the problem. Other macros can be added in the same fashion.
It would be possible to make these changes on a course-by-course, or even problem-by-problem basis, but it would take a little care.
Hope that helps.
Davide