Conditional action hooks

During page request, WordPress actions are triggered in a sequence, therefore you have to register them in time. In your case, wp_head comes after wp_enqueue_scripts, so as a solution, i would all remove them from the wp_head and register them all in a condition, outside of any other action:

if ( isset( $_COOKIE['user_opt'] ) ) {
    add_action('wp_enqueue_scripts', 'user_checkout');
    // ...
    // add relevant actions here if isset $_COOKIE['user_opt']
} else {
    add_action('wp_enqueue_scripts', 'user_opt_handler');
    // ...
    // add relevant actions here if not set
}

About the cookies. They are part of HTTP header, therefore they must be set before any output (not after as you stated above).

As for your second question. That’s nothing specific to WordPress, that’s standard behavior of callable. Please note, that callable might be specified differently:

// It might be anonymous function (closure)
add_action('wp_footer', function() {});

// A function
add_action('wp_footer', 'my_custom_function');

// Method call
add_action('wp_footer', [$obj, 'my_object_method']);

// and more...

And as you can see in the method call, that would be a way to get your context work with the function (assigning whatever values you want to $obj). As in $obj->a="hello world";