Once I learned how to use STMCubeMX, I never went back to Arduino. Comparing STM boards with Arduino in terms of price, RAM, Flash, GPIO, analog, ... and R4 looks like Steve Buscemi doing the "hello fellow kids" meme. I think the big win for Arduino was the ecosystem and simplicity, but the big embedded players have invested significantly in this space with tons of code examples compatible with the arduino add ins (STM boards all have the arduino header).
ESP doesn't scale. Once you start with STM, you can switch to much more advanced boards with ease, ESP doesn't have the range.