I thought i'd update this answer as i was searching for the same thing. Use CPTemplateAPplicationSceneDelegate attached to your SceneDelegate class or your core CarPlayScene class.
use didconnectCarInterfaceController and didDisconnectCarInterfaceController to detect the CarPlay connection status.