Someone who can explain well how self-calibration works before an activity?

Today I did some tests to see how the starting altitude is auto calibrated before starting the activity.

In all three cases, I did not have the phone connected. I tried to do it at three different altitudes, which are those provided by the DEM.

Pressing the Trail Run activity the estimated altitude was 957m, but by DEM it should have been 934m.

In the second case, the altitude estimated by the GPS was 1.122m, but the one using DEM was 1.129m.

In the third case, the altitude was 302m, but it automatically went to 297m what I would have had when calibrating using DEM.

What I would like is for the altitude to self-calibrate each time taking the DEM as a reference, as happened in the third case automatically self-calibrating the altitude. So as to avoid calibrating the altimeter before an activity, but doing it precisely from the activity itself.

Why didn't this happen the previous two times but only in the third?

I was reading about a list of priorities in this article:

https://forums.garmin.com/outdoor-recreation/outdoor-recreation/f/fenix-6-series/283653/how-exactly-does-altitude-calibration-work-these-days/1364062 

If so, DEM data should be taken into consideration before GPS data.