The Icons That Won't Leave
Try it on Finder or Trash: there is no Remove from Dock option. macOS treats them as permanent.
Running apps are the same story. While an app is open, its icon stays, and there's no setting to hide it.
If you came here to hide Finder from the Dock, this is where the native route ends.