All I know is that if my coding ability had been measured through mandatory assignments that I would be force-fed without any immediate need, I would have been disgusted.
"Locking-in" on some esoteric topics just because one wants to is probably the best way to improve in my opinion.
On the other hand I have been through a pretty generalist undergrad education in engineering and it helped in acquiring general math, physics, chemistry knowledge.
I also went through a very generalist CS course, that we call Computer Engineering, which covered from hardware to software plus math, physics, chemistry.
I was already a nerd when I was attending the university. My chance was my instructors and professors let me roam free and convert every assignment to a rabbit hole. Poisoned by demoscene earlier, I was already an elegance/performance freak before even I got graduated, and this made me dive into unknown territory head-on instead of being afraid of it.
I have written a compression algorithm from scratch for graduation, then written a multi-agent trading system for M.Sc. project. For Ph.D. I have written a BEM based material simulation which was able to saturate the system very effectively, reaching practical IPC limits of the processors it ran on.
"Locking-in" on some esoteric topics just because one wants to is probably the best way to improve in my opinion.
On the other hand I have been through a pretty generalist undergrad education in engineering and it helped in acquiring general math, physics, chemistry knowledge.