I used to use Lego to prototype the robots and machines I make. Now I design my own "Lego" with OpenSCAD and program the bots with AVR microcontrollers. Have been doing this for 7-ish years. However, Lego Mindstorms is still a great (although expensive) system for learning.
I ended up getting my five year old the Lego "Boost" set - I wanted some motors &c that were accessible to him. He's had fun putting together the projects, and playing with the scratch programming.
It is tied to their app, but I see that someone has python libraries to talk to it, so I have options if the app goes away.
The most up-to-date location for the actual 3D printable files is in the Tapster project GitHub repo: https://github.com/tapsterbot/tapsterbot/blob/master/hardwar...