as a newbie to Mysensors and platformio this took me a while with the same problem.
The solution (like described above, but not understandable for me at first) is:
platformio.ini add
lib_deps = https://github.com/mysensors/MySensors.git#development
which currently links to Mysensors 2.3.2-beta #ea093e5
and the errror is gone