[runtime] Disallow generic classes with explicit layout. Fixes #23438.