Is it safe to access the underlying mysqli object from \wpdb for custom queries?

It depends on your definition of “safe”.

Is the client always going to be your client? If not, then you’re writing code for them based on assumptions about their hosting environment and available technologies that may not always be under your control, and you may be unnecessarily complicating things for them in the future.

$wpdb is likely to work as-is regardless of any changes to the underlying technologies over time, as long as WordPress is up to date. If mysqli were deprecated, then future versions of WordPress may update $wpdb to work with whatever’s new and supported, but the client will be stuck with your code that depends on outdated technology.

This has already happened before with the mysql_ functions, when they were deprecated. If you were using $wpdb at the time, there’d be no problem. But any sites with code using the deprecated functions directly would begin seeing notices if they moved to a newer version of PHP.

How likely is this to happen again any time soon? Honestly, I have no idea, and only you know your relationship with your client and how big a problem this would even be if it did happen. But there’s a reason you’re ‘supposed’ to use $wpdb, and not doing so is indeed riskier in some respects, if only marginally.

Frankly, reinventing the wheel seems like a poor use of everybody involved’s time.