How to make JQuery load on top of head tag before everything

The function wp_register_script has a parameter called $in_footer. Setting this to false will add the script to the head.

wp_register_script( string $handle, string|bool $src, array $deps = array(), string|bool|null $ver = false, bool $in_footer = false )

In addition, if you deregister jquery, you can manually add the script in your head above wp_head(). This is generally not recommended.