It is not just Elantra... many cars suffer from it.
And inspection, as you said, is your good friend.
Some brake lines are protected better than others. However, one small rock flying into the line can chip off a piece of paint and start the corrosion...
Your solutions are limited to two types of repairs.
1. Get OEM ready to use lines and replace all corroded pieces.
2. Get copper based tubing, flanging tool, fittings, adapters, and whatever else is needed. It will never corrode, is easier to work with (more flexible), but more labor intensive. Yet, overall (if done as DIY) way less expensive than OEM lines.
I used the 2nd option on at least 3 cars and worked great. No difference in feel.
I'm running into some major issues trying to flare the brake lines (besides snow on April 27th! Lol). I'm not sure if the problem is the tool I'm using, inexperience, or a combination of both. So far, I've broken a rental from Napa, took a rental back (same design) to O'Reilly's due to being faulty (crooked flaring cone), and am ready to go buy the same design from Harbor Freight (don't know what else to do without spending serious dough and having to wait until next weekend). The only thing I might try differently is to use NiCopp line because steel is proving to be a PITA to work with.
Also, the flare on the lines is a ISO/bubble flare and has ISO/bubble flare fittings. I think I have to use the same style as what was on there but am not 100% sure. The tools that all the auto parts stores rent is double flare, but with a YouTube hack and flipping them upside down, you can achieve something similar to a bubble flare.
I'm really hoping that this next attempt using copper and perhaps a vice (instead of my hands) provides some success. I'm going to practice tonight - tried probably a dozen times earlier and either the line pushed through or was extremely crooked.
I can't imagine trying to fit the new one-piece lines on the car without them being easier to work with, so hopefully copper is the savior. The two lines are probably 13-15' (RL) and 14-17' (RR) - I have them removed, just need to get new ones installed, but have reached a standstill with these flaring complications. Very frustrating!