Undoing a deleted task should bring back the tasks with the same nesting.
I deleted a task that contained sub-tasks on accident. Upon trying to undo this change, it brought back all of the tasks with their proper indent levels, but they were indented (or nested under) the wrong task.
This feature is already available in Todoist. When you delete a parent (non-indented) task that has sub-tasks and use the "Undo" option, the structure will be added back to the list exactly as it was before, but at the bottom of the list.
Please clarify - what exact structure did you delete? I've tested it with this structure:
| - Sub-task
and I can't reproduce this issue - the sub-task was under the correct parent task.