Only make deeply nested routes shallow when parent is shallow

Since `:shallow` may be set at any point in the resource nesting we should
only make the new and collection routes shallow when the parent is shallow.

This is a bit of a hack but until the mapper is refactored to an object graph
instead of a hash of merged values it's the best we can do.

Fixes #14684.

(cherry picked from commit e10f26f9e90f2fe6c4cd18f70c1e559f2250da56)

Conflicts:
	actionpack/CHANGELOG.md