Platformio build error due to AruduinoSTL

When building my project with ESP8266WiFi and ArduinoSTL, the build fails. Also, even when I don’t include ArduinoSTL and just use ESP8266WiFi, the build still fails. The only ways I’ve found to resolve this are either turning off the library dependency finder and manually specifying the dependencies for the project, or just uninstalling the ArduinoSTL library. The following is one of the many errors brought up during the build:

.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:57:9: error: ‘WiFiEventHandler’ does not name a
type
WiFiEventHandler onStationModeConnected(std::function<void(const WiFiEventStationModeConnected&)>);
^

Thanks in advance.

You can ignore unwanted libraries with Redirecting...

And how would I go about building the project when both ESP8266WiFi and ArduinoSTL are included? Because that seems to be where the conflict arises.
The library dependency graph:

|-- ArduinoSTL
|-- ESP8266WiFi
| |-- ArduinoSTL

From what I can gather, ArduinoSTL is being seen as a dependency for ESP8266WiFi when it shouldn’t be? Sorry if I’m missing something obvious.

Does PIO include library which should not be used?

This is an example of the code I’m trying to build, where I’m using both ArduinoSTL and ESP8266WiFi. But PIO seems to make ArduinoSTL a dependency of ESP8266WiFi, when it shouldn’t be. This then causes the errors during the build. (ignore the backslash)

#include <\ArduinoSTL.h>
#include <\ESP8266WiFi.h>

using namespace std;

vector <\int> v;

void setup() {
v.push_back(5);
}

void loop() {

}