You can't prevent incoming Mail appearing within All Mail. This is a "feature" of Google Mail (Gmail).
Gmail doesn't actually have (or use) mailbox folders per-se. Instead, Gmail instead uses "labels" - however, to confuse matters, your Mail client shows the label lists as folders. When first encountered, the concept of labelling appears very alien to most Users who are accustomed to the logic of a conventional mailbox folder regimen.
Unlike strict folder structures, within which an individual email messages may reside in just one folder, "labelling" allows a message to effectively be listed in more than one location.
As such, an incoming Mail message will appear in both the Inbox and All Mail label lists. Mail rules might cause additional labels to be assigned, such that a message can also appear within other lists at the same time.
https://support.google.com/mail/answer/118708?hl=en-GB&co=GENIE.Platform%3DDesktop