Is there a WordPress boolean for “theme_customizer_active()”?

Hook a function to the customize_preview_init action. In that function, do your add_action for the wp_head.

The customize_preview_init action runs in the call that renders the frame that the preview page is displayed on, and happens early enough to hook onto wp_head.