Fix counter_cache for polymorphic associations

Fixes #16407.

[ActiveRecord::Association::Builder::BelongsTo][belongs-to] does not take into account polymorphic relationships. This change takes care of that.

Unfortunately, the fix broke a test. Fortunately, the test depended on this bug being present. I've removed it and detailed the reasons in the commit message. I'm copying it here for completeness' sake:

    At this time, counter_cache does not work with polymorphic relationships
    (which is a bug). The test was added to make sure that no
    StaleObjectError is raised when the car is destroyed. No such error is
    currently raised because the lock version is not incremented by
    appending a wheel to the car.

    Furthermore, `assert_difference` succeeds because `car.wheels.count`
    does not check the counter cache, but the collection size. The test will
    fail if it is replaced with `car.wheels_count || 0`.

/cc @senny

[belongs-to]: https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/builder/belongs_to.rb#L38

Removed it from there (and also rebased).