It's also to stop clashes during portion working, and has been done for years well before ICEs even existed. In the old days of long night services with multiple splits and joins, numbers were often 3-digit - probably each coach operating on a night service in the whole country had a unique number to avoid any issues.
This was a practice brought about particularly by the number of
'kopfbahnhöfe' (literally head stations, - terminii in UK railspeak) in many German cities. As trains had to reverse direction to continue their journey (and in steam days, often to change the loco), sleeper services often shed a few coaches at each stop and more were added at the loco end. The detached coaches could them proceed to a different destination, maybe withy other 'cast-off' sleeping cars. This meant that passengers needed to be very sure of their coach to avoid waking up somewhere completely unexpected.
I remember in 1963 on a school holiday to Germany and Austria, boarding a couchette at the rear of a long train at Wien Westbahnhof. We can recall looking out of the window several times in the night, and wondering why the train sometimes seemed to be going backwards. When we arrived at Ostend, the our coach was right at the front, but still travelling in the same direction that we had started in Vienna.
Since those days and the ever increasing use of Electric haulage, many cities changed these stations to more conventional through types.