What are custom ROMs from a technical standpoint. Is all of Android open source so these modders take the complete source code and customize it? Or is Android part binaries part source so the modders can make some changes but not all?

I just don't quite understand what the custom ROM developers have to work with. There's a known bug, for example, with the SMS dropping incoming messages when internal memory gets below 20MB. Is this something the custom ROMs could (in theory) fix or do they have to wait for Google to fix it first?

And when the ROM community waits for a new Google release are they waiting for new binaries or waiting for the source to do a diff and incorporate the changes manually?

Edit: I had "SMS system", which would be Simple Message System system... kind of like "PIN number"