Never change core functionality! Updating drupal will override your changes and is not good practice at all. Keep in mind that all other modules uses core too so things goes really wrong if you mess with core.
You can do custom user form like this (link to other answer):
drupal 7 cusomized user profile template can not save changes
There is also hooks for altering form handling. So you can change user form validation like this:
hook_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'user_profile_form') {
$form['#validate'][] = 'your_validation_function';
}
}
Or if you want only to use your own validation change:
$form['#validate'] = array('your_validation_function');
You don't have to check queries when including user library. Just include it like:
function wr_pages_init() {
module_load_include('inc', 'user', 'user.pages');
// And other includes (if needed) same way.. like:
// Add jquery ui libraries..
drupal_add_library('system', 'ui');
drupal_add_library('system', 'ui.sortable');
drupal_add_library('system', 'ui.datepicker');
// Add ajax..
drupal_add_library('system', 'drupal.ajax');
// Some own JS
drupal_add_js(drupal_get_path('module', 'wr_pages') . '/js/mysuper.js', 'file');
}