After many hours of debugging a concurrency issue, we ended up finding the culprit in the xsparql source:
The XQueryEngine enum works as a singleton for xqueryEvaluatorSaxon, however this class is not thread safe.
Our entrypoint was XSPARQLEvaluator which uses the XQueryEngine enum to get the actual evaluator. I've rewritten our code to go against the xqueryEvaluotorSaxon directly which fixes the issue for us. Unfortunately I don't have time to fix the problem in the xsparql code.