I don't know what they look like these days but I loved K'nex as a kid. They're similar to legos, but designed from the outset to be dynamic/mechanical (instead of having that awkwardly retrofitted on). You could even get motors (both electrical and wind-up) which you could then stick an arbitrary rod through and do whatever you wanted with the rotational motion
Edit: Looks like they're still alive and kicking! https://basicfun.com/knex/