add a limit and a test to FlattenExceptionTest.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13003
| License       | MIT
| Doc PR        |
Well, it is ... otherwise you don't count the total items, but just the amount of items in your current recursion chain. 

````
[
  [1, 2, 3]
  [1, 2, 3]
  [1, 2, 3]
]
````
In this example $count would result in a maximum number of 6, but it should be 9