Fix interactions between `:before_add` callbacks and nested attributes assignment of `has_many` associations, when the association is not yet loaded.
See CHANGELOG for details.

Improved tests and fix by Ben Woosley (see PR 11525)