Why showing a contractId on ledger results in "<contract-id>" value?

Is this later addition deterministic?

No. The suffix is a hash of the contract data that is randomized with a cryptographically strong seed.

Can you export this “suffix” function upstream?

The format of the suffix is intentionally undocumented because it evolves across SDK versions in incompatible ways, as new Daml features are developed. As such, it cannot be part of the public stable API.

I would expect the client-side function to be capable of both failure and success, allowing me to implement a retry mechanism around it to handle potential failures and eventually resolve them.

What kind of failures are you referring to? It is in general impossible to predict the seed that randomizes the hash.