Game engine if your goal is to build your dream game. If you prefer to learn to be a better coder stick with doing things from scratch.
The Long One
After around a year of pursuing my bachelor's degree in Computer Science, I discovered the power of free YouTube tutorials. I remember watching a guy show how to create windows, lines and so on in Java using the JFrame and Swing libraries.
As someone who spent all my time after school gaming before college, I found my passion here - being able to create games by myself.
How it began
It started with me getting some snail and gun images from the internet and creating an endless shooting game I called "Mars Defense" in Java. It was pretty hard at the time. In college, all I did was prepare for exams - I had never done anything bigger than Tic-Tac-Toe. And here I was, having to code something relatively big for the first time. It was a fun experience.
Then I made another game where you use your mouse to escape from circles. I made 3 maps. On one they would fall like rain. On another, they would chase you. On the last, there was a boss fight with an exploding sun in multiple stages.
It felt good creating games, combining the joy of coding and gaming. It was fun to watch my family actually enjoy playing them.
Somewhere in the middle
Then, as we learned C in college and I heard somewhere that you should use C++ to create games, I moved to C++ with the SDL library. I created a cool platformer game where users could design their own maps, place cannons and sharp objects, and play them. It was fun. I also created a local version of Snake with different game modes and more.
Then I found free OpenGL tutorials online. I got deeper into this cool world. Over time, I built classes that made creating new games easier, which I then copy pasted into each project. In some games that were created during this time you hunt and get hunted by wolves, in others you control characters and build things, like in Age of Empires type games. The 3D models were taken from free sources of course, as I had no idea how to draw anything at this point.
Get to the point already
I was against moving to a game engine for a long time. I thought I was doing the "real" thing, and that in game engines, it was mostly drag and drop, not real coding, so I would continue doing everything myself.
But after playing Hollow Knight somewhere in 2019 and watching YouTube videos of people building cool effects in Unity, like the sand when player lands, the particles, animations etc something changed.
I came to the understanding that I wouldn't be able to create such amazing projects with pure coding alone and that I needed to use the most powerful tools available, even if it meant using a game engine and, ehm, some drag and drop.
Moving to Unity
Indeed, using Unity and its libraries handled many things. But the time it would have taken me to, say, code my own network solution for a game transitioned into other things that made the game better.
I found myself doing everything. Learning to draw, animate, create sounds, marketing, publishing, and so on. The fact that Unity made creating a game so much easier allowed me to learn other things and experience every aspect of building and releasing a full game.
Yes, it's not "pure" programming, but I learned a lot more valuable things than if I had just coded everything from scratch. Also, despite the fact that the games I created are light-years away from the level of projects like Hollow Knight, they look a lot better, and they give a lot more joy to others who play them.
The Conclusion
So, the main point is this: if you, like past me, think that because you are coding everything yourself makes it better, give game engines a try. Creating a production-ready game involves a lot more than just coding. By allowing game engines to make your life easier, you give yourself the time to create more fun, better games, along with increasing your chances of succeeding with a real project.
If you want to just practice coding and don't care about the final product much, then remain with scratch. But if your goal is to make your dream game, to learn all aspects of releasing a finished product (which will teach you a lot), or to give people the fun that you had when you played games yourself, give game engines a try.