Refactor to use Extension data object for @extend.

This is a preliminary step towards keeping the context of an
@extend so that nested extends can be handled correctly (#11271).

Change-Id: I79acb7a86749aeddf67fa6358d3df25ee8a1ef1e