If it worked using "materialize-on-write" semantics, why wouldn't you, as an alternative to the verbose code which checks every path component that might not exist, and instantiates it before doing the assignment?
Obviously, you can't use it if you don't have materialize-on-write semantics in the assigned expression not that you shouldn't.