Passing primary key down to nested struct using cast_assoc

I’m using cast_assoc/3 to cast some nested associations in my changesets. The simplified schemas look like this:

schema "trial" do
  has_one :chief_investigator, ChiefInvestigator
  has_many :principal_investigators, PrincipalInvestigator
end
schema "chief_investigators" do
  belongs_to :user, User
  belongs_to :trial, Trial
end
schema "principal_investigators" do
  belongs_to :user, User
  belongs_to :trial, Trial
end
schema "users" do
  has_many :accounts, Account
end
schema "accounts" do
  belongs_to :user, User
  belongs_to :trial, Trial
end

Which all put together form an association that follows this structure:

%Trial{
  chief_investigator: %ChiefInvestigator{
    user: %User{
      accounts: [%Account{}]
    }
  },
 principal_investigators: [
    %PrincipalInvestigator{
      user: %{
        accounts: [%Account{}]
      }
    }
 ]
}

My problem is that the trial primary key is not being passed down to the %Account{} schemas. The correct user key is being passed, but not the trial one. Is there something in how I’ve designed the schema that’s impeding this? I could retrospectively insert the key after insertion, but that would be messy given how nested the data is.