This appears to be a specific Docker feature which treats Dockerfile differently when it’s ignored. From the docs:
You can even use the
.dockerignorefile to exclude theDockerfileand.dockerignorefiles. These files are still sent to the daemon because it needs them to do its job. But theADDandCOPYinstructions do not copy them to the image.
The Docker daemon running on our remote hosts needs the Dockerfile to run the build against the uploaded context. But it should not show up in the final image. Docker doesn’t appear to support this feature using a filename other than Dockerfile.