Cannot open source file "kobj-types-enum.h"

Can you, in that same CLI, do

/home/tom-retterath/.platformio/penv/bin/python -m pip install setuptools

and clean recompile (delete .pio folder and build again)

Edit: It says here that distutils was removed in favor of setuptools, exactly starting at Python version 3.12: https://stackoverflow.com/a/76691103/5296568

So my Python 3.11 version may as well be the reason.