We have tried reproducing the problem with the following directory structure:
E:\projects\temp\Libs\2.cpp
E:\projects\temp\Libs\STM32\1.cpp
E:\projects\temp\Libs\sub\3.txt
It did get uploaded as expected (STM32 got excluded):
/tmp/xyz/2.cpp
/tmp/xyz/sub/3.txt
If you expect different behavior, please let us know the exact full paths of files on the Windows machine that get uploaded despite being excluded and the full path of the solution file.