Platform.IO code only runs right after flash, Arduino IDE works though

Hello, I hope this is the correct place to post this.
I have an ESP32-WROOM-32U. I am using Platform.io to program it and here is my conf (sorry INI code refuses to format correctly):

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
board_build.flash_mode = qio
lib_deps = bblanchon/ArduinoJson@^6.17.3
build_flags = -D CORE_DEBUG_LEVEL=5 ; show me all the things!

This builds, and the code runs on the esp32 RIGHT after flash. If I cut power and re-power the chip, I get:

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x23 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download

This happens ONLY when using Platform.io, Using the Arduino IDE does not cause this issue.
I am guessing it has something to do with my config, but have no clue where to start looking.

This is what I see when I flash using the Arduino IDE:

Sketch uses 216321 bytes (6%) of program storage space. Maximum is 3145728 bytes.
Global variables use 15524 bytes (4%) of dynamic memory, leaving 312156 bytes for local variables. Maximum is 327680 bytes.
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting.....
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: e8:68:e7:08:74:04
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 16MB
Compressed 8192 bytes to 47...
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4036.8 kbit/s)...
Hash of data verified.
Flash params set to 0x024f
Compressed 17392 bytes to 11186...
Wrote 17392 bytes (11186 compressed) at 0x00001000 in 0.1 seconds (effective 965.4 kbit/s)...
Hash of data verified.
Compressed 216432 bytes to 110815...
Wrote 216432 bytes (110815 compressed) at 0x00010000 in 1.7 seconds (effective 1011.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 118...
Wrote 3072 bytes (118 compressed) at 0x00008000 in 0.0 seconds (effective 1515.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

And with that, everything is great.

Any help would be greatly appreciated
Please help me :cry:

Thank you very much!
-Kevin

If you get this message then the voltage at GPIO0 must have been LOW / GND on startup, since it enders bootloader download mode. (Home · espressif/esptool Wiki · GitHub)

Can you measure the voltage there?

My scope is showing a constant 3.21v on GPIO0. On both the Platform.io and the Arduino IDE builds.
Though for some reason, the Arduino IDE works… I am totally stumped…

Hm maybe UART boot VS download boot Trouble - ESP32 Forum helps or ESP32-WROVER randomly goes into download mode (ROM serial bootloader for esptool.py) - ESP32 Forum? The important bit is definitely that

which shows what the ESP32 saw on boot, according to here,

GPIO strapping results: Bit5-bit0 of boot_sel_chip[5:0] correspond to MTDI, GPIO0, GPIO2, GPIO4, MTDO, GPIO5, respectively.

(also repeated here)

so 0x23 is binary

0010 0011

meaning it saw GPIO5, MTDO(GPIO15) and MTDI (GPIO12) high, all others (including GPIO4,2 and 0) were seen high low, thus bootloader mode has been entered.