There may be ways to do it, I'm not entirely sure.
But this seems like a bizarre request. The point of personalizations is two-fold: First, to give users individual flexibility in customizing their UI and give groups of user tailored experiences for their specific role. Secondly, and this is relevant here, to avoid adding/deploying code for non-code UI related things.
You're about to add code, to define (hard-coded?) form changes and trigger a function intended to avoid code in the first place...? Why not just customize the form(s) directly?
In my opinion, unless your intention is to automatically distribute personalizations to users (which there are already ways to do that using roles), you may as well just customize the form directly if you're adding code anyway.
The only other thing I can think of, is that you may be trying to create a different experience to setup personalizations. In that case, I would encourage you to reach out to us or files ideas on adding these features in the base product. In any case this is an area of investment so if you're trying to do something like that you're at risk of spending lots of time on something that may get added or changed anyway.
In any case, I would like to hear your intention here. If there's a gap in personalization features, we'd love to hear it.