Why is Unity the most popular engine?

Unity 4 -> Unity 5 … same code base with some things added. Same API. Deprecated functions dating all the way back to Unity 3.0 or even further. Many tutorials from UT3.0 still work syntactically in UT5.0

UDK -> UE4 … completely new code base (yes it is built from previous pieces). Different API (correct me if Im wrong here). UDK Tutorials do not work in UE4. UE4 is very much a “new” engine when compared to Unity despite its roots dating back to UE1 (18 years ago)

CoD engine is a heavily modified version of the original Quake 2 engine…would you say that they are the same engine? Where do you draw the line?

Completely rebuilt is kind of the wrong choice of words, though it isn’t completely inaccurate. If I took a LEGO castle, destroyed it, and put it back together with the same pieces, it is still rebuilt. UE4 is assembled from pieces of UDK (while many of those pieces were replaced or revamped). I may be wrong about this, but I followed UE4 a lot when it was first released to the and this is the way I understood it to be.