Better ActiveRecord hierarchy for Dirty and others

1. `Dirty` overrides `Core` behavior.

Moved `Core` so it is defined before `Dirty`, `Inheritance`, and `Scoping`. This way those classes can properly override `Core` functionality.

This is nice because `@changed_attributes` references can now be pulled out of `Core` and put into `Dirty`.

2. `Serialization` overrides `Dirty` behavior.

Moved `serialized_attributes` concepts out of `Dirty` and into `Serialization`.


NOTE: I did not alter the behavior defined in #8328 - but I'm hoping this will make those changes easier.