How do I automatically assign a node to a term?
If it was me, I would add a term reference field to user, then when the user becomes "writer" and the related term was created I just added that term to user,

Then using rules, when the user creates a story, I would need to attach term to node, likely I have the term Id attached to user so it could be simply attached to node.

in this way no php code is needed.