[PECOFF][Writer] Templatize connectAtomsWithLayoutEdge()

Templatize connectAtomsWithLayoutEdge() so that it can handle other types of
defined atoms.