Sort of. The shell has no idea what the commands you are running will do, it just connects the output of one to the input of the other.
If `grep` finds more than 10 lines that say "hello world" then `head` will have all 10 lines it wants, and close the pipe. This will cause `grep` to be killed with a SIGPIPE, so it does not need to continue scanning a very large file.