There is no leaning left or leaning right answer to this.
When you want to specialize - do what you can afford to put the next 10000 hours of your time into.
I'll give you my experience - I started as a mobile app developer, got into mobile systems development ( kernel, device drivers, etc), got into build and release process, and stayed there to evolve into the cloud, infra engineer that I am today.
Does it mean I do not understand frontend - NO. Does it mean I hate backend engineering - Definitely not. And I can perhaps tune a given backend for peak performance better than anyone else in this room.
What matters is not what the market is today, but where the market will evolve into tomorrow.
If you're really confident with your fundamentals in computer science, backend, frontend, infra, ops, none of that matters!