What's the formal name for this type of flashing used in stucco homes? And what does it take to replace rusted portions?
I call it: edge metal, J-channel flashing, L-metal flashing. Comes in many types of metals, thickness and thicknesses, (and is commonly custom made.)

Yes, it’s very difficult to repair/replace.