This mod contains code that defines a lua event that fires off when a building is created. The event does not fire for buildings with 0 or less hammer cost unless they have a faithCost greater than zero and are enabledByBelief. The lua event provides the information you need to get the city object and the buildingclass.
More info.
More info.