I wrote my own engine for these reasons:
1. Portability: My engine needs to work on whatever platform I want it do. "But Unity runs on everything, including <insert platform here>", it becomes a problem not being able to use your language of choice.
2. Licencing: No need to worry about licensing fees, which is great.
3. Optimization: Have you ever tried optimizing a closed source commercial engine? It sucks because you can't do it. Size optimization is one issue. One issue I see people talk about when it comes to Unity is minimum binary size. I already have a rather complex engine, and I can remove the complex components that aren't being used if need be. My engine generates very large executables (15mb in general, but VS13 takes 3 minutes to optimize it down to roughly 3mb). Sometimes, that's not desirable, especially if you are running on a platform with fixed resources. Another is rendering. Sometimes, I need certain functionality that Unity might not give me, such as GPU fencing, command buffers/lists, or direct hardware access on certain embedded platforms.
4. Custom needs: Unity can't do *everything*. It does many things, but sometimes, a closed source engine can limit your game in some ways, sorta like above.
Reasons I don't use Unity (don't take offense to this, I'm entitled to my opinion):
1. I wouldn't be caught dead writing a game in C# (my preference).
2. Pride as a seasoned and experienced programmer; I'm not a n00b.
3. I don't like Unity, or the fanboys who can't do a dammed thing without it, and yet criticize those who write their own.
I'm also going to say this (and I've said it before). When people hear the words "writing your own engine", they are immediately thinking "writing everything from scratch, hence re-inventing the wheel". This isn't always the case, and in mine, definitely not. My engine consists of multiple open source components with compatible licenses making it suitable for commercial projects. You don't have to write everything yourself. Let me give you a rundown as to how I chose my engine's components:
- Tokamak for physics.
- Stb for texture based ttf font rendering and ogg decompression.
- Assimp and OpenCTM for 3D mesh parsing.
- SDL for various portable solutions involving threading/synchronization, timing, OpenGL context management, input devices, etc.
- Some misc code from the NVSDK used for debugging and other stuff.
- NVIDIA's Gameworks SDK for lots of misc stuff, like the excellent open source and extensive math library.
- NVTriStrip to "stripify" primitives.
- jo_jpeg, a simple jpeg library I use for screenshots.
- ezxml or irrXML for XML parsing.
- Enet as a reliable UDP based networking client.
- Angelscript for scripting.
What I have written is basically the glue to put everything together in a neat and organized set of interfaces. Some things I wanted to write myself, such as an extendable 3D rendering, audio and input interface that supports Direct3D, core OpenGL, OpenGL ES, OpenAL [soft], FMOD, OpenNI, Leap, etc. So putting this all together was done rather quickly, and done in about 2 months worth of work off and on. You might say that "I don't have that sort of time". Then fine. Time is the most valuable resource, as it is not renewable, but it's also important to use your time wisely, and considering my needs, it was well worth it, (and no, I didn't do nothing but write this engine; I worked on it in conjunction with a planned title).
This isn't an attempt to belittle those who use Unity, it's my defense from those who act like they are better than me because I don't. Do what works best for you. I've chosen my path, and it works best for me. If you need Unity or UE4, go for it.