There are many answered questions that address the usage of "which" and "what" on this site—many of them marked as duplicates—and there is even a specific tag for this topic. But I could not find any answer for the following question:
Should I use "which" or "what" or something else if I want to express
A does B which/what causes C.
Therein, "which/what" (the "which" or the "what") should not refer to B but to the act of A doing B (i.e. the predicate of the main clause).
For example see these alternatives:
Bob writes on the blackboard which causes a screeching noise.
Bob writes on the blackboard what causes a screeching noise.
Please note: The noise is caused by the writing not by the blackboard.
Side question: Would the use of a comma be appropriate here?
There is a closely related question, "Do we use “which” or “that” when referring to the preceding main clause as a whole?", that aims on "which" versus "that" as the alternatives and is answered in favor of "which". But maybe "what" would be the better choice here.