"Suppose you want to add a main menu. It's not always an easy task."
Tying your shoes are not always an easy task, let's spend 2 years building a shoe tying machine! In a hundred lifetimes well saved in the time it took building the machine on tying shoelaces. I bet it's well worth it!
Edit: "You need simple semantic markup that gives you room to grow."
As far as I can tell your script only generates a list. If it's semantic or not depends entirely on the context...