Refactor UrlManager, bootstrap Gii to add its own routes.

These changes refactor UrlManager to allow Gii and other modules to add routes to UrlManager during the bootstrap process, after the main app has been initialized.

Also sets up Gii to add routes to UrlManager if bootstrapped. This saves users from having to manually add extra routes to their config file to get Gii to work when custom routes are set in their apps.