Can ESP8266 send AT commands to self?
The AT command set for the ESP8266 is implemented through custom firmware which has to be flashed to the chip to use.

If you've written your own software which is running on the ESP8266 then that's what's flashed to it - the AT command set will not be available because you've overwritten it with your own software. So there's no way to send AT commands to yourself because if you've written software that could do that, then it's present and the AT command-interpreting software is not.

In that case you should look deeper into the Arduino core for the ESP8266 to find the equivalents to the AT commands you wanted to use. This is the code that calls setup() and loop() and implements Arduino-compatible functions like pinMode(). It also provides libraries like ESP8266WiFi. There are many un- and under-documented functions in the code. You can almost certainly find the equivalents to anything that you can do with an AT command in here.