Revert "Merge pull request #11053 from yangchenyun/mine"

Those two files are required by active_support/rails.rb
loaded in active_model.rb

It is common to require common dependencies on the root
files to avoid boilerplate in each file.

This reverts commit 763635e30f17800ebc0a8ae98d780edc8ebfb4e5, reversing
changes made to 4f46ef36aaef217834f3f96d3689d32f6a6761ea.
Change a way ActiveRecord's config is prepared for rake tasks

In commit d1d7c86d0 I moved setting migrations paths into activerecord's
railtie to remove Rails dependency on databases.rake. However, it
introduced a regression, ENGINE_PATH was not available at the moment, so
engine's migrations where not added properly to paths. Fix was added
at 97a4a771, but it changes a way things work from using ENGINE_PATH to
APP_RAKEFILE. Additionally, the config runs when the code loads, while
previously it ran in the db:load_config rake task

In order to make it more in pair with original version this commit
changes the config to run only on load_config task. This code uses the
fact that defining a task in rake does not overwrite, but only appends.

It also allows to get back to checking for ENGINE_PATH
Setup env and seed_loaded for DatabaseTasks outside load_config

Those vars can be used in tasks, which not call load_config.