I have also tried using 18, 19 and 20 instead of A0, A1 and A2, same result.
What am I doing wrong or missing?
How do I get these pins to acts as digital outputs?
Another strange thing is that when I run this code, pin 15 will toggle simultaneously with pin 16.
I just put a Pro Micro on a breadboard with your sketch and I'm not seeing anything unusual. LEDs on A0, A1, A2 and pin 16 are flashing, and the LED on pin 15 stays off.
Taking a deeper dive into the 32U4 datasheet I notice that the problematic pins are also used for the JTAG interface, and if this is enabled, these pin won't work as digital outputs. I have a hunch the JTAG interface is enabled on my devices.
It seems I must use an AVR ISP programmer to fix that. I will see if I can manage that.
This is the best AVR ISP programmer I've ever used, which also doubles as a USB-serial converter. Comes with a nice GUI that allows you to control various options, and works well with both 5V and 3.3V MCUs.