APL (Dyalog Unicode), 35 33 bytes
Saved 2 bytes thanks to Adám (and would have saved 1 with a tip from Bubbler)
{1≥|⊃⍵-⍵⌹=⍨⍵:0⋄1+∇h,3÷⍨3+/⍵,h←⊃⍵}
A recursive function.
Explanation:
{
1≥|⊃⍵-(+/÷≢)⍵: 0 ⍝ Base case: If it's the last iteration, return 0
⍵⌹=⍨⍵ ⍝ Average of ⍵ (the array) (not sure why that works)
=⍨⍵ ⍝ Compare ⍵ to itself to create an array of 1s the same size as ⍵
⍵⌹ ⍝ ⍵ divided by that (matrix division)
⍵- ⍝ Subtract that from all elements of ⍵
⊃ ⍝ Take only the first of those differences
| ⍝ Absolute value
1≥ ⍝ Is it less than or equal to 1?
⋄1+∇h,3÷⍨3+/⍵,h←⊃⍵
h←⊃⍵ ⍝ Assign the first element of ⍵ to h
⍵, ⍝ Append to ⍵ (because of wrapping)
3+/ ⍝ Take groups of 3 adjacent elements and sum each
3÷⍨ ⍝ Divide each sum by 3 (to get average)
h, ⍝ Prepend h, which stays constant
∇ ⍝ Call on this new iteration
1+ ⍝ Add 1 to that
}