I encountered unexpected behavior.
I used a library with lib_deps that does not compile with the RP2040. After removing the library from the lib_deps list in platform.ini and cleaning up it still didn’t compile. That was due to the library still being in the .pio\libdeps folder and thus the compilation failed.
I thus had to manually delete all files in the libdeps folder. I was expecting that the clean function would do that.