My example was a library, so both the library and it’s caller are in the same release artifact (binary/JAR/whatever).
If you’re changing the interface of an RPC service, then you can’t do that in a single commit, and need to fall back to something like the second approach, but with even more caution to make sure you properly account for releases and the possibility of rollbacks.