[NFC] [Serialization] Avoid using DeclID directly as much as possible

This patch tries to remove all the direct use of DeclID except the real
low level reading and writing. All the use of DeclID is converted to
the use of LocalDeclID or GlobalDeclID. This is helpful to increase the
readability and type safety.

GitOrigin-RevId: d86cc73bbfd9a22d9a0d498d72c9b2ee235128e9
35 files changed