The Origin of Gravity From First Principles