only recusively delete modules if all their parents are marked for delet...

...ion (PLAT-333)

@dmitchell , may you please take a first look? I changed the tests a bit, and and added a management command. But otherwise the change is quite small
Probably should just use `ItemFactory` but since the existing one didn't, idk that you're responsible for fixing that.