and most importantly, voids the warranty
That is completely false.
The ONLY ways altering your iMac can void the warranty is if you damage something in the process or you alter a "warranty void if removed" sticker. The only item with one of those stickers is the CPU.
Simply replacing the hard drive or optical drive will not in any way affect your warranty.