You don't need to cycle through the layers to get at the hatches. Lisp gives you the ability to select all hatches and then you can cycle through each of them identifying the layer so that the region created can have the matching layer.
This lisp code I modified from another thread should convert all your hatches to regions leaving them on the same layers. But what it does not do is remove the current boundaries those hatches may have.
So give HBREG.lsp a try.
; hbreg converts all hatches to regions
; Modified from:
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/create-a-region-instead-a-polyline-around-hatch-pattern/m-p/5317853/highlight/true#M326510
(defun c:hbreg ( / clayer ctab el h hd hl hs i ss)
(if (setq ss (ssget "_X" '((0 . "HATCH")))) ; select all hatches
(progn
(command "_.Undo" "_BE")
(repeat (setq i (sslength ss))
(setq el (entlast)
h (ssname ss (setq i (1- i)))
hd (entget h) ; get data
hl (cdr (assoc 8 hd)) ; get layer
hs (cdr (assoc 410 hd)) ; get space
ctab (getvar "ctab") ; get current space
clayer (getvar "clayer") ; get current layer
)
(if (not (eq hs ctab)) ; chk if not in current space
(setvar "ctab" hs) ; then set to that space
)
(if (zerop (getvar "tilemode")) ; chk if layout
(command "_.Pspace") ; then make sure in pspace
)
(setvar "clayer" hl) ; set hatch layer as current
(command "_.-HATCHEDIT" h "_B" "_R" "_N") ; create hatch boundary as region not associate
; (command "_.-HATCHEDIT" h "_DI")
(if (not (eq el (entlast))) ; if region created
(entdel h) ; delete the original hatch
) ; if
(setvar "ctab" ctab) ; return to original space
(setvar "clayer" clayer) ; return to original layer
) ; repeat
(command "_.Undo" "_E")
) ; progn
(princ "\nNo Hatches Found.")
) ; if
(princ)
) ; defun