Its worth noting that I received offers from over 50% of companies I interviewed at and I certainly am not bad at coding - this was just a particularly bad interviewer using a very bad problem. With this company, I actually told them I wouldn't accept an offer even if they did give me one because the interview was so bad.
I understand that whiteboard can be frustrating and hard, but it sounds like your interview was the exact kind of interview people try to make
In the past when I've been the hiring manager, I've had inexperienced interviewers ask my candidates questions like this for all kinds of positions - when you look at who does well in other interviews and gets an offer (and performs well), it basically never correlated at all to performance in whiteboard-only CS-focused interviews.
In this case I was interviewing for a full-stack senior position where there would almost certainly be zero systems-level coding, so the interview should have been a throwaway at best.
Space constraints do come up frequently and being able to reason about them is important.
A good interviewer prefers it if the candidate does not have the algorithm memorized. The whole point is to gauge their problem solving skills. Reciting something from a textbook doesn't tell the interviewer much. The reason you didn't get a favorable reaction in that situation could be because not knowing the algorithm was perfectly acceptable in that situation. It's expected that you figure it out instead of challenging the validity of the question.