Having the locks in the tcl-layer does not necessarily help, when one stored procedures calls other stored procedures and bypasses the lock. This can certainly lead to the lock-conflict you are seeing.
I would expect that when you add the lock statement into the three (not two) mentioned stored procedures, the problem will go away (the lock statements can the be removed from the tcl code).
I can be certainly wrong with that assumption, which is purely hypothetical, since i have not tried to reproduce the error you are seeing (i have just a script for stress-testing xowiki).