How to define dependent geometries (e.g. for a male-female connector design)
The plan is to use the Bool tool addon that is Default in blender and can be activated in Edit &gt; Preferences &gt; Addons ,then create a big cube

this will act as a female port holder , where we will create our female port
Now you can add another small cube to be used as our male adapter

Then select the small cube &gt; then the big cube(please follow the order) and click  N
to open properties tab , go to Edit tab and expand Bool Tool to find the brushes.

now Choose the slice option .You can notice that the part of smaller cube intersecting with the mesh has sliced it to create a new block , now you can change the geometry of the original small cube to change the slicing in both big and sliced cube

This method is responsive and geometry changes in real time
for legos this can be done with a boolean brush
Model a Lego

Make sure that the bottom of the lego is a little bigger and the top a little smaller then duplicate the lego and put it a little above the first lego.

Run a boolean brush , like this (Remember select the bottom lego first )-