fix(ngAnimate): defer DOM operations for changing classes to postDigest

When ngAnimate is used, it will defer changes to classes until postDigest.
Previously, AngularJS (when ngAnimate is not loaded) would always immediately
perform these DOM operations.

Now, even when the ngAnimate module is not used, if $rootScope is in the midst
of a digest, class manipulation is deferred. This helps reduce jank in
browsers such as IE11.

/CC @tbosch --- alternative/more general fix here

Closes #8234
Closes #9263
@IgorMinar unfortunately the current behaviour is exposed to applications and tests via the `beforeAddClass` and etc apis, and via the arguments of the animate DOM event handlers... In short changing this breaks ngAnimate tests, and potentially a lot of application tests.

I think it's the right behaviour, but I'm just saying introducing it would be a huge breaking change, maybe we don't want to do that