Remove keg test dependency on formula
Remove hardcoded paths in keg tests
Add tests to demonstrate failure to prune empty directories
Keep track of pruned parent directories
Always prune empty toplevel directories when unlinking

Closes #21750.