Fixed a regression introduced in 84cf156

84cf156 (PR #15694) introduced a subtle regression. There are actually three
distinct entry points to creating an AR object – via .new (i.e. #initialize),
via #init_with (e.g. from YAML or database queries) and via .allocate.

With the patch in 84cf156, attribute methods and respond_to? will not work
correctly when objects are allocated directly, without going through either

The reason this test case didn't catch the regression was that the `Topic`
class is shared between test cases, so by the time this test case is ran the
attribute methods are very likely to be defined.

Switching to use a fresh anonymous class in the test to ensure we surface this
problem in the future.
The comment is actually correct. The test was added for Syck (the YAML implementation in <= 1.8.7), not Psych. In fact, Psych [also calls](https://github.com/tenderlove/psych/blob/960d30ef5ac4ab93db199852fcd93f3cc3dfe1dd/lib/psych/visitors/to_ruby.rb#L47-L49) `allocate` followed by `respond_to?`, but it doesn't call `respond_to?` with the attribute method names.