Qute: insert in for/each doesn't have the desired effect
### Describe the bug

When putting a `{#insert}` section inside a for loop (or an each loop) in qute, nothing gets inserted and the default body is used instead.

### Expected behavior

That one is able to write an include-able template in which a `{#insert}` section is inside a `{#for}` / `{#each}` section.

### Actual behavior

The `{#insert}` section doesn't insert the template from the including template but instead uses the default body.

### How to Reproduce?

Reproducer: [qute_insert_for_bug.zip](https://github.com/quarkusio/quarkus/files/7573051/qute_insert_for_bug.zip)

Steps to reproduce the behavior:
1. Add an new template; name it "list_layout.html" with a following content:
```
<!DOCTYPE html>
<html>
    <head></head>
    <body>
        {#for e : list}
            {#insert row name=e}No section body<br>{/}
        {/for}
    </body>
</html>
```
2. Add an second template; name it "helloworld_list.html" with following content
```
{#include list_layout}
    {#row}
        Hello world, {name}!<br>
    {/row}
{/include}
```
3. Write a resource/controller wich uses following code:
```
@Path("/list_helloworld")
public class HelloWorldRessource {
    @Inject
    Template helloworld_list;

    @GET
    @Produces(MediaType.TEXT_HTML)
    public TemplateInstance helloworld() {
        return helloworld_list.instance().data("list", new String[] { "Tony", "Ben", "Bruce" });
    }
}
```
4. Run the quarkus application and visit `http://localhost:8080/list_helloworld` in your browser.

### Output of `uname -a` or `ver`

Linux 5.14.16-arch1-1 #1 SMP PREEMPT Tue, 02 Nov 2021 22:22:59 +0000 x86_64 GNU/Linux

### Output of `java -version`

openjdk version "11.0.13" 2021-10-19

### GraalVM version (if different from Java)

GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05)

### Quarkus version or git rev

2.5.0.Final (using io.quarkus instead of io.quarkus.platform)

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

### Additional information

_No response_
diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java
index 2bdc5915a1b..55986531e0e 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java
@@ -108,9 +108,9 @@ public SectionBlock getExtendingBlock(String name) {
                 if (block != null) {
                     return block;
                 }
-                if (parent != null) {
-                    return parent.getExtendingBlock(name);
-                }
+            }
+            if (parent != null) {
+                return parent.getExtendingBlock(name);
             }
             return null;
         }
diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java
index 0b6247b7073..ef7a6af72de 100644
--- a/independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java
+++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java
@@ -156,4 +156,11 @@ public void testAmbiguousInserts() {
         }
     }
 
+    @Test
+    public void testInsertInLoop() {
+        Engine engine = Engine.builder().addDefaults().build();
+        engine.putTemplate("super", engine.parse("{#for i in 5}{#insert row}No row{/}{/for}"));
+        assertEquals("1:2:3:4:5:", engine.parse("{#include super}{#row}{i}:{/row}{/}").render());
+    }
+
 }
['independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java']