How much functionality does a demo like this get for free in addition to its own 4KB of code? For example, do modern GPUs have rich functions like createAmazingFractalGeometry() which these demos then piece together?
They're not getting much from the GPU at all. Procedural modelling Houdini style is very common and you will find that algorithms to describe models/textures are often quite small, especially when compressed.
These days we do a lot of procedural generation of content, but then we don't make the user re-generate it because it does have a performance penalty--GPUs have plenty of RAM and tons of bandwidth, so it usually doesn't make sense.
source: Did some dev work on Houdini
[0] https://www.iquilezles.org/www/articles/distfunctions/distfu...