Is there a way to override the thread class in C++ to use the platform
depended RTOS?
There's no easy way to do this, but there have been attempts to do so by others as pointed out by @Arthur Passo. Even that's not simply overriding the OS specific classes, instead you need to hook toochain calls to look at the FreeRTOS api whenever OS specific call is needed. This would in turn raises so many questions about keeping things maintainable across different compiler versions.
Since I have been doing a similar sort of investigation a few months ago, I reckon the best possible solution would be one of the following. (I would personally stick to option 1 given the amount of flexibility and convenience in maintenance).
Make your own C++ OS abstraction layer on top of CMSIS OS API which most of RTOS providers support(FreeRTOS, KeilRTX, Chibi support it, I am sure uc-OS does it as well). This makes it easier to use a single abstraction with many RTOSes as long as your build system is capable of linking the proper files depending upon the RTOS being used. This at the same time gives you full flexibility to configure thread priorities, stack sizes etc. which might not be possible if you go with something like posix api.
Make your own C++ OS abstraction layer on top of POSIX api. FreeRTOS provides a POSIX API https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_POSIX/index.html, I'm sure others will have a similar variant of it.