The correct solution is to specify the platform version - always!
If you want to stick to the official PlatformIO Espressif32 platform use this (for example version 6.12.0)
platform = espressif32 @ 6.12.0
If you do not specify a version, the one with the highest number installed on your system will be used.
Here you will find a list of available pioarduino und PlatformIO espressif32 platform versions
The PlatformIO Core is not related to the espressif32 platform version.