There is a very elegant Grav-way of initialising form fields with data in frontmatter by using the Form Plugin method setAllData().
It’s a well kept secret. On the other hand, the how-to is in this forum, see Twig in form yaml, dynamic input values
It took me over two years before I found that post last week. I will be dropping the plugin I created which resembles the answers in this thread.