EEPROM, FLASH, etc. are not any more viable than magnetic media, and maybe worse. They will lose the cell charge over time and lose the contents.
OTP ROM may be a possibility. I am talking true OTP, not just UV erasable EPROM packaged in a plastic non-windowed package which is what most "OTP" ROMs are. True OTP would use a series of fusable links that are blown out or kept during programming. This seems like an immutable, physical change type of programming that can't occur or revert spontaneously. It should last. You may need to build something to read out the contents of your ROM chip in 25+ years, but that will always be possible.
I have a pile of TDK archival DVD+R discs for backup of small data. They are rated 100 years, and they are coated with the same ultra-hard coating that blu-ray discs use to prevent scratches. Obviously it is impossible to truly test the data retention, but so far so good. I don't need them to last forever, but longer than the 'cheapest I can find' CD-Rs I bought back in the early days of optical disc burning, would be nice.
Maybe your best policy is to not depend upon longevity of your chosen medium media, but to refresh the media (whatever they are) every N years, possibly updating the data while you are at it.