Preferences: Check for pipeline before removing elements

Fixes #10430
2 jobs for master in 7 minutes and 11 seconds (queued for 1 second)
Status Job ID Name Coverage
  Test
passed #21238
code-quality

00:05:27

2.0%
 
  Build
passed #21240
windows

00:01:43