Replace manual Encodable implementation for LayoutDataRef with Untraceable

Fix #3412