Rather than take some locks, you can now prevent the database objects from changing with an event trigger. pg_dump could install that event trigger in a preparing transaction, then do its work as currently, then when done either remove or disable the event trigger.
All the event trigger has to do is unconditionnaly raise an exception with a message explaining that no DDL command is accepted during when a dump is in progress.
I'm thinking of a case where a hot standby is executing a pg_dump and DDL is issued on the master -- would that cause any unexpected problems on the hot standby?