Add fields in generic instances too when AOTing. Fixes #5316.