Help with Dial Plan Syntax and Logic Flow

Centos-6.5/FreePBX-12 Distro
FreePBX-12
Asterisk-11.14.2

I am trying to figure out what happens in extensions_override_freepbx.conf. Two years ago I managed to cobble together a working modification that sets a specific ring tone for internal calls by borrowing bits and pieces from here and there but not really understanding how things worked. I therefore ran some experiments recently and I need an explanation for the observed results.

This is the experimental setup I created in in extensions_override_freepbx.conf:

[from-internal-noxfer]
include => from-internal-noxfer-original
;-------------------------------------------------------------------------------

[from-internal-xfer]
include => from-internal-xfer-original
;-------------------------------------------------------------------------------

[from-internal-original]
include => from-internal-noxfer-original    ; asterisk 11
include => from-internal-xfer-original
include => bad-number                          ; auto-generated  (FreePBX)
;-------------------------------------------------------------------------------

[from-internal-noxfer-original]
include => from-internal-noxfer-custom
include => from-internal-noxfer-additional ; auto-generated (FreePBX)
;-------------------------------------------------------------------------------

[from-internal-xfer-original]
include => from-internal-custom
include => from-internal-additional          ; auto-generated (FreePBX)
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)
;-------------------------------------------------------------------------------

The foregoing does nothing, but it works insofar as nothing breaks either.

However, If I add this then I get an endless loop:

[from-internal-noxfer]
exten => s,1,Set(HLL_EXTEN=${EXTEN})
exten => s,n,Set(HLL_INTERNAL=true)
exten => s,n,Set(HLL_TRANSFER=false)
include => from-internal-noxfer-original
;-------------------------------------------------------------------------------

[from-internal-xfer]
exten => s,1,Set(HLL_EXTEN=${EXTEN})
exten => s,n,Set(HLL_INTERNAL=true)
exten => s,n,Set(HLL_TRANSFER=true)
include => from-internal-xfer-original
;-------------------------------------------------------------------------------

[from-internal-original]
include => from-internal-noxfer-original   ; asterisk 11?
include => from-internal-xfer-original
include => bad-number                      ; auto-generated (FreePBX)
;-------------------------------------------------------------------------------

[from-internal-noxfer-original]
include => from-internal-noxfer-custom
include => from-internal-noxfer-additional ; auto-generated (FreePBX)
;-------------------------------------------------------------------------------

[from-internal-xfer-original]
include => from-internal-custom
include => from-internal-additional        ; auto-generated (FreePBX)
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)
;-------------------------------------------------------------------------------

Why does adding the exten => s,1,. . . instruction cause an endless loop?