You can't do that for shared_preload_libraries, because at shared_preload_libraries time we don't have access to the DB and can't look up the installed extension version(s). There might be different ones in different DBs too.
Won't work for some hooks, right?
I've faces this issue with pglogical and BDR. If the user tries to update the extension before a new enough .so is loaded we ERROR due to failure to load missing C functions.
If the .so is updated first the old extension function definitions can fail at runtime if funcs are removed or change signature, but won't fail at startup or load.
So we let the C extension detect when it's newer than the loaded SQL ext during its startup and run an ALTER EXTENSION to update it.
We don't attempt to support downgrades.