Do not copy properties indiscriminately from `constraints`

Fixes #17250.

(cherry picked from commit 492fbe3cbfff2987c7b29fb7b5232f4c9ee7566a)