wp_dropdown_roles() to replace option value = code

The wp_dropdown_roles() function internally uses get_editable_roles() to fetch the needed roles. It does nothing else than fetching the roles from the global:

$all_roles = $GLOBALS['wp_roles']->roles;

and filter it afterwards:

return apply_filters( 'editable_roles', $all_roles );

So you can simply add the following function to a plugin or your functions.php file of your theme:

function wpse137935_filter_editable_roles( Array $roles )
{
    // Don't conflict and remove immediately
    remove_filter( current_filter(), __FUNCTION__ );

    // Do any logic in here that appends or removes roles

    return $roles;
}

Then, right before the call to wp_dropdown_roles(), you add:

add_filter( 'editable_roles', 'wpse137935_filter_editable_roles' );

It’s important that you add the filter as late as possible to not crash into other plugins or your theme if they/it calls the same function elsewhere.