PostgreSQL - triggers to fire only on replicated db
You can do that with logical replication, but not with streaming (physical) replication, because in the latter case the standby server is read-only.

For logical replication, you have to define the trigger as replica trigger:

CREATE TRIGGER tgname ... ON TABLE atable ...;
ALTER atable ENABLE REPLICA TRIGGER tgname;