APL (Dyalog Unicode), 7070 66 bytes
D←⊢-1∘⌽
+/,{16=×/|D⍵/⍨×⍵×D⍵}¨¯2 ¯2↓1⊖1⌽ר(⍉1↓⌽)⍣4×(⊢-{⊂(,⍵)[6 9 8 7 4[8(-,⊢)3,⍳3]}⌺3 3)⎕
-4 bytes thanks to @Bubbler and @ngn
Full program that requires ⎕IO←0
⍝ Helper function D: cyclic differences of a list
D←⊢-1∘⌽
⊢ ⍝ Each element
- ⍝ Subtract
1∘⌽ ⍝ The one after
⍝ Main code
+/,{16=×/|D⍵/⍨×⍵×D⍵}¨¯2 ¯2↓1⊖1⌽×(⊢-{⊂(,⍵)[6 9 8 7 4,⍳3]}⌺3 3)⎕
⎕ ⍝ The input grid
{...}⌺3 3 ⍝ For the 3×3 window centered on each cell:
(,⍵)[6 9 8 7 4[8(-,⊢)3,⍳3] ⍝ Obtain the cycle elements clockwise from the right
⊂ ⍝ Ensure that the output is the same shape as G
×⊢- ⍝ The sign of the difference between each cycle and its center in G
¯2(⍉1↓⌽)⍣4 ¯2↓1⊖1⌽ ⍝ Trim off the entries with centers on an edge/corner
{...}¨ ⍝ For each sign-difference cycle:
×⍵×D⍵ ⍝ The indices where a +/- segment ends
⍝ (nonzero and different from the following element)
⍵/⍨ ⍝ The signs of each segment in order
⍝ (must be ¯1 1 ¯1 1 or reverse to be truthy --- can only have entries +/- 1)
D ⍝ Cyclic differences (must be 2 ¯2 2 ¯2 or reverse to be truthy --- can only have entries ¯2, 0, or 2)
16=×/ ⍝ Test if product is 16: ensures right length and right values.
⍝ Note that the sum of the cyclic differences are always 0, so 2 2 2 2 is impossible)
+/, ⍝ Count the total number that meet the condition