I'd like to build a firmware for multiple "gadgets" based on ESP32 and rp2040, like all those console mods and adapters which are popping up, but using "profiles" like OpenWrt does for different platforms.
Any input is welcome!
I am probably going to ask this in other places as well.
Mostly - no. They're microcontrollers rather than CPUs, which already have ecosystems built around them (Tasmota, ESPHome, Arduino, MicroPython and friends).
I've got a bunch of NodeMCU boards doing a variety of jobs, all running various flavours of Tasmota. How much RAM a given board has depends on the MCU and the board itself, but it's not unusual to find them with no more than 512kB SRAM (and usually less!).
The RPi2040 has 2MB of SPI Flash on-die, and most boards also have 264kB of SRAM to play with.
I'd have to say that OpenWRT is probably not a great fit for these kind of devices.
As has already been noted, they don't really have the RAM/ROM for a 'full' linux operating system like OpenWRT bundles.
You're probably better off looking into the other alternative OSes mentioned, or lighter linux variants like Zephyr. Some of the devices might not even warrant linux, and instead you might have more luck with something like FreeRTOS.