Custom registration form

I am resolving problem for registration. I have two option:
a) custom registration outside keyloak and do it with another frontend+backend
b) use keycloak registration form + backend

In this case I would like to use option b) and use Keycloak solution. But I need different registration workflow. I need split registration to two phases:

new user fill input with id → click on next → user information (email tec) is retrieved from the backend (e.g. via REST) according to the user id and it will sent temporary token to email → new user will see a new form with input to fill in this token → click on ‘create’ keycloak creates a new user

Is it possible to customize the registration so much?
I’ve found providers for authetization in using, for example, email, but I’ve never found how to edit the registration form. What provider in Java would I need to use for this? FormAction?