I have coded DFS many times in my life, both at high school and atleast a dozen times each during my Bachelors and Masters and far more times at work because I do a lot of NLP and traversing a tree is a regular day at work.
I can code DFS with you today, when out at a bar over a few beers.
What I struggle with is to code DFS:
1. with people I don't know, am not comfortable with
2. who are looking at me expectantly, expecting me to fail at it (because that's what happens in most of the interviews they have been part of)
3. with time running out
They only time I was able to perform DFS at an interview was at my first job out of college because just the month before I had prepared for my Data Structure final exam and could code DFS (or any of the HackerRank style algorithms) in my sleep no matter what even if all I had was a chisel and a slab of granite.
I was not upset that I never had to actually code the DFS, invert a binary tree and find the minimum coin change (all the 3 questions I was asked for the job) ever after that - it was all C++/Python/Java CRUD, for 3 years because I had 0 professional experience with CRUD at that point so I would have never got the job in the first place.
In fact the official policy at that place was to always use existing commercial libraries (and purchase them if necessary) because it was a CRUD shop and they had high turnover so any custom library would quickly become a liability.