Why this code for ESP8266 goes into STA+AP mode?
It goes into STA+AP mode because your code is telling it to do that.

If you want it to just go into STA mode then your line:


WiFi.mode(WIFI_AP_STA);


should be


WiFi.mode(WIFI_STA);