Use RHS's struct def ID for error messages in pattern matching

Fixes #14541