Modifying the maxCommandChainLength gamerule value inside a function or command block does not affect the currently running chain.
- Download the attached file MC-124447 datapack.zip and place it in the datapacks folder of your world
- Set the maxCommandChainLength value to 2
- Use the following command
→ It executes only one command
- Run the function again
→ Now it executes both commands