If your server is running Ubuntu, then rather than installing LibXML::XML from cpan, I recommend installing the Ubuntu package libxml-libxml-perl.
However, none of the Perl dependencies will have anything to do with the MathQuill issues. That is all JavaScript, and none of the Perl dependencies affect that.
You mentioned that you are getting the warning "Content Security Policy (CSP) prevents the evaluation of arbitrary strings" regarding usage of things like "eval" and "new Function" and such. None of WeBWorK or PG's javascript uses any of those things. However, one thing that can cause that is if the JavaScript and CSS files are not being loaded correctly. From your screenshot I can see that the third party JavaScript and CSS seems to be working (I see that the MathJax rendered), and the webwork2 JavaScript and CSS seem to be working (at least the Bootstrap styles are in effect which come from webwork2 css), but the PG JavaScript seems to not be working (MathQuill is in PG). So the thing to focus on is /opt/webwork/pg/htdocs/. Make sure that the file /opt/webwork/pg/htdocs/statis-assets.json exists and has content (running "npm ci" in the pg/htdocs directory creates that file among other things). Also, if you are proxying via apache2 (or any other proxy or related sort of thing -- like a load balancer), then make sure that you the pg_files route is properly configured with the proxy. If you are proxying via apache2, then check the conf/webwork2.apache2.4.conf file.
Note that the display errors for specific problems are most likely the same issue as the MathQuill issue since many problems use PG JavaScript and CSS.
Additional warnings in problems could also be due to a change that we made to make those warnings that used to only go into the apache2 error log be shown in the user interface. That is intentional so that problem authors start fixing their coding issues. Those warnings are only displayed for instructors and not for students though.