LayoutRenderTag initializes its LayoutContext in the initialize() method that is called from setName(), expecting that setName() is called prior to setDynamicAttribute(). It is explained in the comments that it can't be called from setPageContext() due a dependency on setName(). I didn't find the dependency, but hit another problem: FreeMarker does not guarantee the order in that the attributes are set. In result the setDynamicAttribute() method may be called prior to setName() and then it causes a NullPointerException because 'this.context' is not initialized yet.
I resolved it for myself by overloading setPageContext() and moving the initialize() call into the method.