How to move “Collapse Menu” to top of admin bar?

Rule of thumb is do not modify any core WordPress files. Those in the root, wp-includes, wp-admin. You could do this easily with JavaScript:

/**
 * Move the 'Collapse menu' item to the top of the admin menu
 *
 * @return void
 */
function wpse348570_move_collapse_menu() {

    ?>
        <script>
            if( jQuery( '#collapse-menu' ).length ) {
                jQuery( '#collapse-menu' ).prependTo( '#adminmenu' );
            }
        </script>
    <?php

}
add_action( 'admin_footer', 'wpse348570_move_collapse_menu' );

You can add the above as a plugin or place it into the child theme.