I'd argue that "setting an example," or specific deterrence, has lessened in severity with the rise of liberal democracies. The notion is about as old as law itself. There was some pretty brutal stuff way back. Still have some big contemporary outliers like electrocution in some states in the US, but that's going away steadily.
Anyway, the notion of deterrence, in the United States, if you consider this a modern liberal democracy, is codified in the federal sentencing guidelines: https://www.ussc.gov/guidelines/2021-guidelines-manual/annot...
irrelevant technicality: I suppose setting an example could also be construed as general deterrence based on a instance of specific deterrence.