It's not hard to make a military unit that can do worker actions. All you need to do is create a new Unit, assign it build actions in the Unit_Builds table, and you're done. Many of us have done this in our own mods.
However:
1> Since it'll now be a military unit, it won't be able to stack with other military units, but WILL be able to stack with Workers and Settlers. This is not adjustable; any unit with a combat strength is automatically considered a military unit, even if you force its strength to be only defensive.
2> No, you can't make it automatically upgrade itself to be comparable to an era-appropriate strength. Or to be more specific, you CAN, using Lua, by creating a series of units and using Lua to auto-upgrade every one each time you go through an era transition. But if you're doing that, you might as well just make the series of units as normal and let the player handle the upgrades.
3> You'll need to do a LOT of animation work to have each era's worker unit animate correctly for the wide variety of build actions.