fix nested `has many :though` associations on unpersisted parent instances

Fixes: https://github.com/rails/rails/issues/16313

If we have
```
class Post < ActiveRecord::Base
  has_many :books, through: :author
  has_many :subscriptions, through: :books
end

class Author < ActiveRecord::Base
  has_one :post
  has_many :books
  has_many :subscriptions, through: :books
end

class Book < ActiveRecord::Base
  belongs_to :author
  has_many :subscriptions
end

class Subscription < ActiveRecord::Base
  belongs_to :book
end
```

then if `post` is not persisted, e.g `post = Post.new`, then
`post.subscriptions` will be empty no matter what.

In contrast if `post` is persisted,
e.g if `post = Post.create!` then `post.subscriptions` works as
expected.

This property could be considered even more unusual since
associations in general, work on records that are not persisted.

e.g if
```
class Post < ActiveRecord::Base
  has_many :subscriptions, through: :author
end
```

then `post.subscriptions` works as expected in all of the
above cases.