Multi_press_2 event strangely emitted automatically after wifi restarts

I am using the Matter light switch with Home Assistant and have set up an automation to trigger actions based on single or multiple presses of the configuration button. However, I noticed something strange: whenever the Wi-Fi reconnects after a modem restart, the multi_press_2 action is always triggered unexpectedly. It seems like the switch might be automatically emitting the last configuration button press after reconnecting. Is there a way to prevent this behavior? Alternatively, is there a more reliable method to detect button presses?

alias: Master bedroom light switch buttons
description: ""
triggers:
  - trigger: state
    entity_id: event.master_bedroom_light_switch_config
    id: config_state_changed
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - config_state_changed
          - condition: state
            entity_id: event.master_bedroom_light_switch_config
            attribute: event_type
            state: multi_press_1
        sequence:
          - action: << sample action 1 >
      - conditions:
          - condition: trigger
            id:
              - config_state_changed
          - condition: state
            entity_id: event.master_bedroom_light_switch_config
            attribute: event_type
            state: multi_press_2
        sequence:
          - action: << sample action 2 >