[grids.referenceelements] fix caching for ReferenceElements