The main reason is to avoid "impossible" situations, for example if you were in one of the Hauntyard areas and all your Pokemon that could hit the ghosts were KO'd, it'd be a challenge to get though all the ghosts without being KO'd. You'd also have to start over with different Pokemon if the boss is a ghost as well. It's an unlikely situation, yes, but think of it as a good thing. It helps you in the game after all!
It's a similar concept to how they don't let you remove HMs in the main series games; if you removed an HM in a specific location, you'd be stuck given that you don't have a move that can get you out e.g. Teleport, Fly, Dig, etc.