[Serialization] Try to clean up PendingUndeducedFunctionDecls when
PendingUndeducedFunctionDecls is not empty
Close https://github.com/llvm/llvm-project/issues/120277
This turns out to be a simple oversight initially. See the analysis in
https://github.com/llvm/llvm-project/commit/ba1e84fb8f45e102f40f409fcfe9b420fbf9fb70
for the wider background.