Eager to implement handling of mbedignore within pio

Not directly. To build the firmware for any framework, PlatformIO pushes the work into a dedicated builder script for the framework. Look at e.g. platform-ststm32/builder at develop · platformio/platform-ststm32 · GitHub, you will see a main.py script (this is mainly responsble for upload logic and high-level firmware generation and conversion logic) and then the sub-builder scripts like framework/mbed.py. These are however are only forwarder-scripts which forward the work to framework-mbed/platformio/platformio-build.py, which located in the package of the mbed-os framework. This is done so that the package can arbitrary implement the builder script as it needs for a particular mbed-os version, otherwise we’d have to have one static script in the platform supporting every version.

The script that is found there is also centralized in GitHub - platformio/builder-framework-mbed: ARM mbed build script for PlatformIO Build System. The real work happens here, by using the Python APIs provided by the mbed-os framework. You can see e.g. the self.ignore_dirs variable being used in this function. This script would need changing to support that, no need to modify the core (platformio/platformio-core), that’s the wrong place. The script should be locally in C:\Users\<user>\.platformio\packages\framework-mbed\platformio\platformio-build.py (and friends).

Mbed-CLI is just a command-line tool frontend to the Python functionality of the mbed-os APIs.

I can also suggest reading through this to understand the inner workings.