The easier way to insert a unit into the established build option list would be to modify the Lua that creates the build list itself, instead of trying to hack the XML. Right now, it does all units (by ID), all non-wonder buildings (by ID), all national wonders (by ID) and all wonders (by ID). Within each category, it does a simple FOR loop over entries (which means by IDs) and adds each eligible unit as it comes up.
So what you'd want to do is change the units to sort by, say, the ID of the tech prerequisite of each unit; you'd create a temporary array, loop once through the units, place their IDs in the appropriate spot in that array, and then do a second loop where you display based on that new array. If you did this by tech ID then your new UU would be placed right where the original unit would have been, since they'd both require the same tech and it'd be unlikely any other units would be at that tech.
The only real downside to this is that the way the IDs are done in the vanilla game sorts units by "type", with all the naval units together, all air units together, all non-combat units together, and so on. I suppose you could add that logic to the sorting array, by looping over units with a given Domain first and putting anything with Strength=0 in its own category. It's a little more work, though.
This isn't idle speculation, really; I've been thinking about something like this for my own mod. My new future-era units are currently all sorted by tech, with lower-tech units listed first (because that's how I added them to the XML), but I'm trying to change that.