On OC v3, the code is working fine.
On two different instances of OC v4, this code is submitting twice the request AjaxHandler, and therefore the code behind is creating 2 users, in that case.
As a workaround, I had to put the code behind a DB:transaction with a lockTables