What you describe is one of the main reasons why I use Rhino3D. It can be scripted via the Grasshopper plugin, which integrates really nicely with Rhino and its primitives. Sadly, Rhino isn't open source and is quite pricy
However the downside with featurescript and I think a big mistake on their part was to use a custom language rather than python or javascript. Featurescript is almost javascript but with some syntax changes and magic DSL's. You are also forced to use the inbuilt editor which is horrible and if you have burned VIM keybinding into your nerve endings, going back to non modal editing is horrible.
Also the discovery of featurescript modules in the community has terrible UX. It's super weird that they have such a great system but finding useful extensions is horrible.
Build123d is much better (supports STEP export and import) but a tightly integrated CAD frontend would be ideal!
FeatureScript is a different beast. It actually runs as part of regeneration in Onshape. Standard features (extrude, loft...) are also defined in FeatureScript, so your custom features are the same first-class citizens with a interactive GUIs and stable updates to upstream changes. You can freely mix interactive CAD and custom code by adding standard features and custom features.
You can do that in FreeCAD. Performance is horribly slow in my experience, but maybe I'm doing something wrong.
https://wiki.freecad.org/Scripted_objects
https://wiki.freecad.org/Create_a_FeaturePython_object_part_...