Improve #5476 - "Nested attributes with callbacks bugfix" to use add_to_target and clearer tests

This PR addresses the comments in the #5476 PR. See the thread there and commits here for explanation.