Peak current consumption is very high, making it impossible to solve this problem using standard smoothing methods (such as conventional capacitor-based circuits).
Supplying this peak requires a special energy source. A capacitor can serve this purpose, provided it is connected in a non-traditional way.
First, it is important to determine where to connect the capacitor. It must provide an energy reserve of 2 mJ (as mentioned earlier); however, it cannot deliver all its stored energy. The maximum allowable voltage drop limits the fraction of energy that can be transferred to the ESP. When connected to the 3.3 V rail, the capacitor can deliver about 17% of its energy (for instance, when discharging from 3.3 V to 3.0 V).
If connected on the 5 V side, about 56% of the energy can be utilized (during a drop from 5 V to 3.3 V, accounting for the voltage drop across the DC/DC converter).
Using a step-up/step-down (buck-boost) converter instead of a standard buck converter would allow for 97% efficiency (with a drop from 5 V to 0.8 V).
Second, the capacitor cannot be connected directly to the USB power source. It would attempt to draw all available power, so—as previously noted—a current limiter is required. Theoretically, an LC filter could be used, but it would need to smooth out the current spike while charging the capacitor from zero to full capacity over a relatively long period (to keep the current within acceptable limits). This would require an inductor with a fairly high inductance value.
Last but not least, the capacitor charging process will result in a slow voltage ramp-up in the power circuit. Consequently, you would need either a suitable DC/DC converter that ensures the correct output voltage rise time (I am not sure such devices exist), or use of the converter's "Power Good" signal, or an external reset IC for the ESP (alternatively, you could enable the built-in Brown-Out Detector and hope for the best).