This is a video tutorial showing how you can implement a backtrack algorithm inside unreal. This is currently how I'll be generating the maze data for my current project Salvos.
Part 2 shows you how to spawn in the walls using static mesh instances and can be found at the link below.
Part 2: https://youtu.be/lzpnrjCBVQM
Everything in this tutorial should work in UE5 as well.