[1.7.x] Added test for the #23070 problem

Backport of e569144910e336d2f76a3a31998ec672377d31cc from master.
[1.7.x] Fixed code to solve #23070 problem

Added a class to wrap callable in settings:
* Not to call in the debug page (#21345).
* Not to break the debug page if the callable forbidding to set attributes (#23070).

Thanks @bmispelon for giving me some advice.

Backport of d0889863de50d65659f56f0b9ea0672a8b6482a1 from master.