Everyone uses git for source control, of course you check out a site with git.
All you are telling people with a .gitingore is what is _not_ available.
It means exactly that people can not access them if your site is a checkout, because they aren't there.
The build process can trivially skip .gitignore files (and all other files that are strictly for dev environments).
You then deploy the build artifact to production, with exactly the set of files which ought to be there.
In those cases a build process is usually trivially easy to put together, and has benefits, so while not necessary it's still beneficial.
Paths in .gitignore means git ignores them. Doesn't mean the file doesn't exist. It means it's not in source control.
An example is a .env file. It may very well be _required_ in many PHP or node projects but it's going to be ignored.