v.23.8Performance Improvement

Add rewrite_count_distinct_if_with_count_distinct_implementation setting for countDistinctIf rewrite

Add setting rewrite_count_distinct_if_with_count_distinct_implementation to rewrite countDistinctIf with count_distinct_implementation. Closes #30642. #46051 (flynn).