As the sibling comment shows, the very latest ESP32 model (S31, not S3) can run Linux. But they can only access maybe 64MB of RAM, and most boards for sale will have significantly less.
In reality, though, the use cases where you need Linux and GPIO are very slim. It's overkill, an ESP32 is realistically more than powerful enough, and Linux isn't even good for GPIO.
I was confused the other day when I was browsing ESP32 on Aliexpress and found models with a price tag of 30~60 euros instead of a couple of bucks. So those models have enough silicon to run a general full fledged OS. Picture me impressed!
For a long time, this was the pivot point between a microcontroller and a bigger machine: Does it need to run an OS?
I've had a couple of RPI's running as home file servers for well over a decade with the only reboots being due to power failures. But today, the cost sensitive option would be a refurbished mini-PC.
On ESP32, its also quite fine to run FreeRTOS, and you can quite reasonably write cross-platform code which runs on both FreeRTOS and Linux, if that's important.
In reality, though, the use cases where you need Linux and GPIO are very slim. It's overkill, an ESP32 is realistically more than powerful enough, and Linux isn't even good for GPIO.