The thing to note is that osm2pgsql -can- detect such changes, because it doesn’t just rely on the contents of the OCS file, it has the full prior state too (aka the OSM data prior to applying the diffs). For example it can regenerate a ways or a multipolygons geometry when a node has moved.
A decade ago I did something similar to what you want to do with database triggers, I’m sure that can be done in a more elegant fashion now with osm2pgsql internal means.