Why are these settings unregistered?

The error message is actually misleading here. WP isn’t checking if the settings are registered — e.g., if ( isset( $GLOBALS['wp_registered_settings']['foo'] ) ) — it’s checking if the form was posted to the default options page (options.php), rather than a custom one (options-general.php?page=foo).

So, it’s entirely possible to get this warning after calling register_setting(), if you’re doing something like this:

<form method="post" action="options.php">

You can just remove the entire action attribute, since it’ll post to the current URL by default. In that case, it’ll include the ?page=foo parameter, so $unregistered won’t be set.