Millisecond Pulsar Origin of the Galactic Center Excess and Extended Gamma-Ray Emission from Andromeda: A Closer Look