For one, in this context, a junior developer will rarely be the smartest person in the room. So it’s really terrible advice for the context.
I think it’s really terrible advice in general though, the places I’ve learned the most is exactly when I’m the smartest person in the room, doing stuff like mentoring or teaching.
In fact I do part time work as an external examiner at IT educations in my country, exactly because they teach me a lot. I’m almost always the smartest person in those rooms, but by evaluating i relearn/refresh things that I haven’t touched in a while.
Aside from that, you’re almost never in a room where there isn’t an opportunity to learn. Maybe you’re the best programmer in the room, maybe you’re the best architect, but you’re very rarely the best at everything, and the modern workplaces thrives the most from teams, in which everyone is the best at something, because they become more than their individual sums by cooperating.
Also just because your the teacher doesn't mean your smarter than all your students you may know more.