Constructions of Lego Bricks Made of Cake
You never said what size the cake had to be, or how well it had to actually hold together.

If you make too large of a cake, it's not going to work -- cake is heavy enough that as you get larger, you need to add additional supports.  Most multi-tier cakes have some sort of rods (plastic or wood) placed in them to help support the upper levels.  If you make it too small, you won't have sufficiently sized knobs for it to actually be able to hold anything.

Most professional cakes are more dense than your home-baked cakes, to help get around this issue, and you can chill them to help firm them up before stacking.  If you're going for a recipe from scratch, look for a pound cake recipe.  If you're using a box mix, you can add in a packet of instant vanilla pudding mix and reduce the temperature by 25°F / 15°C but increase the time.

Size will be an issue as the larger that you get in a single cake, the weaker it's going to be; the bit of crust that you get from the pan is more significant the smaller the cake is.  It'll also be stronger when the dimensions are all close (ie, more cube-like), as you don't have issues with things breaking off due to slenderness.

Your next issue is the connections.  As we're not dealing with plastic, we can attempt to take advantage of two things -- friction, and compression.  To get friction, we need the surface to be rough and fairly strong ... and this means that carving it down is right out, it'd have to be cast directly if it's going to have any strength.  You'll likely have to play with the sizing of the holes vs. the knobs, but you'll want the knobs to be large enough that it's a press-fit, and takes a little effort to seat them (compressing the knob in the process), but not so much force is applied to the cake that it causes a failure at the wall around the hole.  If it were me, I'd try to make the knob between 1/3 to 1/2 the length of the cake, and the knob stick up 1/4 of the depth.

And now you're wondering of course how both the top and bottom could be cast -- by making two molds, and gluing the top and bottom together using icing.  Depending on the strength required, you might have to add some rods to pin it together ... but one vertically through the knob will only help you in compression and sheer, not tension.  For that, you'd need three or more diagonally through the knob in a radial pattern.  I'd personally avoid the supports, with the argument that it's no longer fully edible, and might not be a cake anymore.  (and those who enter gingerbread cake competitions would instead just use something edible as the rod, like an un-bent candy cane).

So, to summarize:


You'll need two molds, one for the upper, one for the lower, bake, level, then join them together.
The knobby bits in theory should be 1/3 to 1/2 the length of the side, and about 1/4 of the total height
The knobby bits should be slightly wider than the hole they're fitting into.
Avoid slender pieces (ie, no 1x4 pieces; 1x1 or maybe 1x2)
Stiffen the cake with gelatin, refrigeration, and bake at a lower temp (but you need to cook it longer to get a bit of crust to form)


And now, for the reason it just won't work :


If they're lego shaped, they're rectangular ... and you can't make a smooth circle out of a bunch of rectangles, at least not until the diameter of the circle is significantly larger than the width of the rectangles ... but we have the slenderness issues, so you'd be making a whole bunch of 1x2 pieces to stick together and it'd be quite tedious.


Depending on what you're willing to qualify as 'cake', this could be possible to make out of gingerbread (as used for cookies and houses, not cake), but you'd have to dry it so far that it'd not cut like a conventional cake.  (make it from layers, then laminate them to make individual pieces, you might have to use hole saws after they're dried to get the proper sized knobs and holes, and then sand to get 'em perfect)