Recordable CD's and DVD's use dyes in the data recording layer, and so are subject to the same kinds of degradation that other dye-based materials are. When I looked into this a few years ago, recordable CD's and DVD's were rated to have a 10-15 year average life at best. The other problem with CD and DVD media is that it's quite fragile, it doesn't take much handling to cause scratches that cause data loss for some files, or sometimes the whole disk.
In the digital computer document archiving world, the normal procedure is to move the files to new media as required when a given media type (or software, or other hardware) becomes obsolete. Individuals have the same options, and even though the scale of the expense is much less for an individual, it's not cheap, but necessary if you're interested in preserving the work over time. Currently magnetic hard drives are the most cost effective, though solid state drives with reasonable capacity are becoming available at competitive prices.
Again, it depends on which CD, DVD, Blu Ray, disc we're talking about. CD-R's have gotten a bad rap due to some of the earlier ones that were made with inferior dyes. Later ones switched to much more stable dyes and are though to last for decades longer.
Also, the dyes are light sensitive, so if you leave them out in the light, they'll degrade much more quickly. The polypropylene discs are sensitive to scratches, however, they too will last a lot longer if maintained in a dark, climate controlled environment. And unlike a physical print, with a CD, DVD, whatever, you're not going to be accessing it that often, so leaving them in a dark, climate controlled environment, like a case in a closet in your house, makes sense and will greatly extend their lifespan without too much cost.
All in all, they are much more reliable for long term storage than magnetic tape and especially solid state drives. The magnetized particles on the tape (or any magnetic media) will lose their charge over time, and if they aren't rewritten every few years, will eventually become useless. Also, the tape itself is made of polymers and susceptible to degradation over time. Still tape is better than the old platter hard drives. And solid state drives are the worst for long term storage (but the best for speed). Getting ten years out of a solid state drive would be a miracle.
Though your right. No media last forever. If something is being archived, it should be copied and periodically recopied onto new media. Archivalness is a long term process, not a short term one. So while optical discs are currently the best media the average consumer has access too for long lasting data storage, they're not perfect. And the most important thing to remember to ensure the archival stability of anything is to keep copies in multiple locations. Because it doesn't matter what you store it on, if it gets burned in a fire or washed away in a flood, it's gone forever.
Recently it was announced that Universal Studio had a bunch of master tapes of many, many famous and important recordings lost in a huge fire. They didn't keep copies on an offsite, because they believed their storage methods were safe enough. They were not. The real problem isn't the loss of the master for John Coltrane, Aretha Franklin, R.E.M., Nirvana, Joni Mitchel, Beck, Janet Jackson, and more. Luckily, their music will live one because of the countless records they've sold and how many copies exist out in the real world. The real tragedy is all of the out takes, unreleased music, and lesser known musicians who's music doesn't exist in the public collection and was lost for all time. This is the stuff that died on June 1, 2008.