No, it's not a test of whether you know it, it's a test of whether you can implement it. If the candidate doesn't know/recall what BFS is, it's trivial to demonstrate the basic idea on a whiteboard, and it's the candidate's job to convert the idea into code. (Which, at the end of day, is pretty much what the vast majority of coding is about.)
It's still not realistic. People don't code on whiteboards. You code (today) with all the resources of the internet at your fingertips, and if you need to invert a binary tree you will use a well-tested implementation from a standard library.
It's not supposed to realistic. It's supposed to be a test of programming ability that fits into an hour interview with time left over for talking about other things. Real world projects last months or years. You can't fit that into an hour, so you have to make do with something that can.
Which is why they're not asking you to do it in an actual job. It's a proxy problem that is easy to communicate so you're not spending the entire interview explaining the problem. Arguably, fleshing out a spec would also be a valuable test, but not the same one.
Sometimes actual code too. For instance, if I'm designing an optimization pass for a compiler, I'll write toy IR programs and show how the optimization pass will rewrite them. And I'll do it on a whiteboard.
I know for damn sure that, if I'm implementing something algorithmically tricky (not BFS, though), I first sketch the details on a whiteboard or a piece of paper.