Hey! That's a cool project! I haven't built a thermostat specifically, but I've used RT-Thread on STM32 for similar IoT applications. For the multi-tasking, message queues are your friend - dedicate a thread to MQTT and let the others send messages when they have data.
As for Wi-Fi modules, ESP8266 is popular and well-documented, though you might need to explore RT-Thread-specific libraries. Getting all those threads synchronized is key, sometimes I feel like I'm playing Drift Hunters trying to keep everything under control! Good luck, and keep us updated on your progress!
Ask Best Practices for Building a Smart Thermostat with RT-Thread and MQTT?