I think there is also an expiration time limit running from the moment the first device receive a message for the others devices to get the same message, but we are in undocumented territory about that AFAIK...
Is this different when iCloud is enabled?
However once the message has been delivered onto the device, they're either stored in plaintext, or backed up in plaintext (with the backup itself being encrypted with a key Apple has)
In saying that... I'm now wondering why they aren't encrypting the messages using the passcode like other sensitive data. I guess so the backup can be restored onto another phone and have the messages persist.
It's a fairly hard problem to do very well. What they do today isn't particularly close to "very well", so even some easy improvements could make it a lot better.
PS: But yeah the optional iCloud backup is currently the weak spot.