I really don't like this solution, it feels like spaghetti—working around an architecturally broken bit of code by making it worse.
If we're passing a hlsl_ir_node to add_load_index() then it should be making use of that node's SSA value, not reaching through to the underlying variable.
Also, I think this is a problem we should deal with for other reasons. For a dumb contrived example, this actually works with native and does what it looks like:
float4 x; x.yxwz[2] = 1;
I hate to suggest it, but if we need that unwrapping logic on the LHS of an assignment, I think the most safe and maintainable thing to do is have an instr type that acts as a deref on any source type. Once again, ironically, that's what HLSL_IR_LOAD used to do. I guess Matteo was prescient when he designed the compiler like that the first time. I don't know if we want that to be HLSL_IR_LOAD or if we want a separate type that we'll lower to HLSL_IR_LOAD.