UFactory is declared at:
Module: UnrealEd
Header: Editor/UnrealEd/Classes/Factories/Factory.h
You cannot package a game shipping Editor modules. If you want to use factories, you must create a Module with IMPLEMENT_MODULE() macro and create your factories in there; making sure that module will NOT be loaded by GAME modules. This is why your packaging fails, because you implement references to classes that are Editor only.
To create an Editor Module for your game project, look at a guide here: