Customize child index of inputs_for form output

I am trying to create a form with a list of addresses and allowing the user to delete or create new addresses through Javascript. I’ve used Rails’ fields_for with a child_index: 'new_record' for a similar functionality where I replaced the new_record string with a timestamp when appending the form fields through Javascript (as explained by this Pluralsight tutorial: https://www.pluralsight.com/guides/ruby-on-rails-nested-attributes).

The trick I am looking for is to have similar rendering functionality in Phoenix is how to generate a nested form with a given / custom child index. Currently I am doing something like this;

<%= form_for @changeset, Routes.user_path(@conn, :update, @user.id), [data: [controller: "nested-form", action: "nested-form#submit"]], fn f -> %>
  <div data-target="nested-form.records">
    <%= inputs_for f, :addresses, fn fp -> %>
      <%= render __MODULE__, "_address_fields.html", form: fp %>
    <% end %>
  </div>

  <template data-target="nested-form.template">
    <%= inputs_for f, :addresses, fn fp -> %>
      <%= render __MODULE__, "_address_fields.html", form: %{fp | id: "user_addresses_new_record", name: "user[addresses][new_record]"} %>
    <% end %>
  </template>
<% end %>

But it doesn’t feel quite right to override the form instance this way. Does anyone has implemented something similar?