Counterspell says When a spell is cast, which means it activates when you spend mana to play the card. Flare is a spell, and destroying secrets requires the spell to have been successfully cast. Since the countering of the spell casting resolves before flare can do any of its effects, the interaction is working as intended.
It's not the 'destroy secrets' effect that's being countered, it's the casting of the card, regardless of effect.
Counterspell says When a spell is cast, which means it activates when you spend mana to play the card. Flare is a spell, and destroying secrets requires the spell to have been successfully cast. Since the countering of the spell casting resolves before flare can do any of its effects, the interaction is working as intended.
It's not the 'destroy secrets' effect that's being countered, it's the casting of the card, regardless of effect.