After 2 days trying anything you can think of, I've found what I was doing wrong: as I wanted to copy a bunch of surveys from one place to another, I had enclosed the function calls in a db_transaction creating another level of nested transactions with those ongoing inside the functions themselves. Removing the db_transaction, the problem dissapeared.
I hope this can save someone else's time.
Thanks Jeff! I was also sure the trigger definition was ok 😊