You stop it at once by using Photoshop correctly.
Use the Command key (Mac) or Ctrl key (on Windows) to selectively highlight the layers you want.
Unlock all locked layers. See the Help files. The Background layer is always locked by default,
Not a helpful answer. Selecting each layer individually makes a simple process take way longer than it should. Been using Photoshop for years and this is the first I've run into this problem.
Just a clarification in general, not necessarily referencing this or any other post:
BOILERPLATE TEXT extracted from the FAQ:
Do not be abusive or aggressive in your tone.
An aggressive, demanding, accusatory or abusive sounding post will often evoke an aggressive or abusive and unhelpful reply.
Remember, you are not addressing Adobe here in the user forums. You are requesting help from volunteers users just like you who give their time free of charge. No one has any obligation to answer your questions.