Is this
...my mouse starts moving and clicking like crazy
behavior looks like mouse moving x100 times (or more) of the original move and each move, even in 1 pixel, results in mouse click? And only solution is to reboot the PC?
...XP-Pen tablet connected to it for drawing, could that be the problem?
Unfortunately, I cannot confirm or deny this. You may try to ask manufacturer of the device if it is compatible with the OBS Studio.
Usually, users of OBS using mouse. Users of tablets, for different versions of OBS, reported wrong screen selection for capture or for the main program window itself, menu and pointer wrong positions for screens with different DPI, some other issues (not capturing cursor, USB port related - bandwidth, power etc), but nothing similar to your issue (at least, here, on the forum, I don't remember it).
Also, you may try to ask in Discord (there is OBS community), link is the top-right corner of the forum.