### Elasticsearch Version

8.11+

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

any

### Problem Description

While indexing documents with dynamically added fields, if multiple of those fields are objects are are deeper than 3-5 objects, performance is degraded significantly.

This bug was introduced in: https://github.com/elastic/elasticsearch/pull/90674

### Steps to Reproduce

I built a micro-benchmark to replicate this particular bug. 

But, any dynamic object parsing will cause this.

To mitigate the issue, statically mapped fields for objects is required. 

### Logs (if relevant)

Attached are two JFR files indicating the difference between when the bug was introduce vs. not.
[Archive 2.zip](https://github.com/elastic/elasticsearch/files/13569248/Archive.2.zip)

server/src/main/java/org/elasticsearch/index/mapper/DocumentParserContext.java
* Side Public License, v 1.
 */
package org.elasticsearch.index.mapper;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexableField;
import org.elasticsearch.common.time.DateFormatter;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.analysis.IndexAnalyzers;
import org.elasticsearch.xcontent.FilterXContentParserWrapper;
import org.elasticsearch.xcontent.FlatteningXContentParser;
import org.elasticsearch.xcontent.XContentParser;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * Context used when parsing incoming documents. Holds everything that is needed to parse a document as well as
 * the lucene data structures and mappings to be dynamically created as the outcome of parsing a document.
 */
public abstract class DocumentParserContext {
    /**
     * Wraps a given context while allowing to override some of its behaviour by re-implementing some of the non final methods
     */
    private static class Wrapper extends DocumentParserContext {