You said in your very first post that the problem happens when the text is inside a form XObject: "if the text layer coming inside xobject:form layer".
In this case my reply "Look in the documentation for the PDEForm methods. It should be obvious which one commits (sets) content." seems entirely relevant. There are only 8 PDEForm methods to look at! I will not name the specific method, that's not what I do.