Origin of correlated isolated flat bands in copper-substituted lead phosphate apatite