Usually, you can. But occasionally you get mildly defective tools that require some directory to exist, even though it's empty. It's easier to add a gitkeep than fix them.

This used to happen a lot. But I don't think that many modern builders require existing directory these days.

Your point is valid though. It would be much preferable to include build/ in your root .gitignore so that the directory is never tracked.