I've found an example.
"On opening the box, be prepared for a slight surprise, as the kit has been (...)."
"(up)on handling" or "(up)on delivery" mean "when handling" and "when delivering," and therefore they are ambiguous, needing context to be clear.
"On arriving home, I noticed a new store had been opened nearby" means just before you arrived home. You can say this before actually enter your house. This is not because 'home' means hometown, but because 'on' doesn't have any sense of 'after.'
So, this statement
"On returning from Rome, he wrote to the ~ (This indicates that he wrote whilst he was in Rome)"
is indeed correct. It can mean he wrote when he was about to leave Rome.
I do trust this writer's sense of language as much above average.
on the occasion of
(formal) at the time of an important event
on the occasion of his second wedding
from Longman
Synonyms: at the time when, (...)
from WordReference English Thesaurus
More: on
'On' has the sense of 'upon,' 'toward,' 'forward,' 'near,' but not 'after.'