counter cache should be aware of self-referential belongs_to association

counter cache is currently not working in rails 4-0-stable when using self-referential belongs_to association. 
eg. 
```
class Message
  belongs_to :parent_message, class_name: 'Message', foreign_key: 'parent_id', inverse_of: :replies, counter_cache: :replies_count
end
```