Not a direct answer to your question but if the goal is anti-spam or anti-bot protection, simply use the built-in honeypot from Gravity Forms.
https://www.gravityhelp.com/documentation/article/form-settings/
Otherwise, I believe you want the gform_pre_render
hook. This is executed before the form is displayed and can be used to manipulate the form object directly.
More info on Gravity Forms’ documentation site https://www.gravityhelp.com/documentation/article/gform_pre_render/