fill form fields with ajax response

First, I can count on one finger the number of times A code which was developed in the hope of being “reusable” was actually reused. Write the code to the specification you can test against. “Reusable” is not a specification you can test against until you have a proper idea what will you need in the future, will is always hard for people that are not future tellers 😉

Second, this means that all meta data should be queriable from the outside which is a security/privacy nightmare as you will have an end point that can be used to query intimate data that might never be displayed in the open. This is BTW the reason that you need to explicitly opt-in meta fields in order to be able to use them in the REST API.