I think there can be two sorts of lessons.
1:
There are quite a few instances in the Scriptures, when God, through prophets, asked ppl to do very simple things, that would result in some miracle. There, the faith or pride of the one asked is tested.
2:
Often too in the Bible, God just want to make a display of His Might. Sometimes in the eyes of others, He gives glory to those through whom He has performed that miracle.
Which of these two do you think it was in that instance?
To Add another thought...........
3. It teaches us to worship God in mist off our problems, and the walls will fall down........sometimes when you struggle with something you need to just worship God and He will take care of the rest..............It's like putting a dirty sponge over a bath then open a tap, eventually the dirt inside will be removed if it keep on being under the open tap.......so worshiping God realease everything, when suffering from depression or stress (these are walls of Jericho), I tell you as soon as you start worshiping Him you will see the weight being lift off from your shoulder and get healed.........For us to reach purity state, we need to worship Him with our whole heart, we will be able to stop all addictions of porn, lust, love of money etc.................Worship realeses demons........wins battles..........
Conclusion
Worship destroy Walls over your life, even coveting
Lastly God is the LORD that fight our battle's so the only thing we need is to Worship Him in times of troubles and He will take care of the rest.........I tell you..............Praise your way out
There are other examples of positioning yourself and worshiping God, while do the rest and provide blessings after that
2 Chronicles 20
Amen