Implement the Dirty API with the Enum feature correctly.

## Problem

When using the Dirty API, the enum feature was returning the raw value of the attribute. This make some behavior weird like the following:

```ruby
conversation.status = :active
conversation.status = :archived
conversation.status_was # => 0
```

## Solution

In #13489 was proposed to override `read_attribute` method but this would be too dangerous since the attribute accessor would always return the string representation of the enum value what make difficult to get the integer value. Also `read_attribute` was made to represent the value read from the database, type casted to its column type.

What we want to solve is the Dirty feature methods and these methods use an internal storage of the values. To fix our problem, instead of changing the way the attribute is represented in all the Active Record features we can only change the way the enum values are written in the internal store of the Dirty feature.

To make this fix possible I extracted a new hook in `ActiveRecord::Dirty` to make possible to we override only the change attribute feature without overriding the whole `write_attribute` method.

cc @chancancode @dhh @tenderlove 

Closes #13489.