Repository: flutter
Issue: Passing the onDidGainAccessibilityFocus callback to the Semantics widget creates an additional semantic node
Labels: platform-ios,framework,a: accessibility,has reproducible steps,P2,found in release: 3.10,found in release: 3.12,team-ios,triaged-ios

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Turn on TalkBack on your iPhone.
2. Use the code sample to build an app.
3. Use gestures to navigate between `Texts` in the `Column`. Notice that only 3 semantic nodes are present.
4. Uncoment 3 lines after the comment `//Uncomment the following to reproduce a bug:`, in other worlds, pass the `onDidGainAccessibilityFocus` callback.
5. Perform Hot Restart.
6. Notice that the 4th semantic node appears.

### Expected results

Passing the `onDidGainAccessibilityFocus` callback to the `Semantics` widget shouldn't create an additional semantic node.

### Actual results

Passing the `onDidGainAccessibilityFocus` callback to the `Semantics` widget creates an additional semantic node.

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Semantics(
          container: false,
          explicitChildNodes: true,
          //Uncomment the following to reproduce a bug:
          // onDidGainAccessibilityFocus: (){
          //  //TODO;
          // },
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              const Text('You have pushed the button this many times:'),
              Text('0', style: Theme.of(context).textTheme.bodyLarge),
              const Text('Test 3'),
            ],
          ),
        ),
      ),
    );
  }
}


```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

The behavior when the `onDidGainAccessibilityFocus` callback is not passed:

https://github.com/flutter/flutter/assets/96211050/7ddbab2b-cb0c-4809-92eb-003661f53b2b

The behavior when the `onDidGainAccessibilityFocus` callback is passed:

https://github.com/flutter/flutter/assets/96211050/cda5fc73-6aa7-46df-a91f-0cad837aef6b

</details>


### Logs

_No response_


<details>
<summary>Flutter Doctor output</summary>

```
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4.1 22F82 darwin-arm64, locale en-UA)
    • Flutter version 3.10.5 on channel stable at /Users/user/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (2 weeks ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/yuriiuvarov/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] Connected device (3 available)
    • User’s iPhone (mobile) • 00008030-0016551C1450402E • ios            • iOS 16.4.1 20E252
    • macOS (desktop)         • macos                     • darwin-arm64   • macOS 13.4.1 22F82 darwin-arm64
    • Chrome (web)            • chrome                    • web-javascript • Google Chrome 114.0.5735.198

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```
</details>