Old working sketch doesn't compile on ESP32 - Seems to need FreeRTOS

Where is this sketch??? Did you write it yourself?

So why not go back to 1.18.19 along with the version of the ESP32 core that you used and see if it compiles again? If so, it seems you have a tool chain or core issue with your current setup.

You are using FreeRTOS, even if you don't know it. FreeRTOS is always running the ESP32. With a "traditional" Arduino scketch (setup() + loop() + Arduino Libraries) all the code runs in one FreeRTOS task. However, ESP32-specific libraries may launch other tasks. You are also free create additional tasks under the FreeRTOS framework.