You wouldn't need to put the original alias command in a function. Just listing it as a windower.send_command is enough. To unalias them though you'll want that in a function that gets called when you change jobs.
Code
windower.send_command('alias g510_m1g1 input /ja "Provoke" <t>')
You would also want to unalias your gkeys when you change jobs.
Code
function user_unload()
send_command('unalias g510_m1g1')
end
An alternate way of doing it and one that I will probably do is just to execute .txt files that alias and unalias my gkeys. I feel like I can have more control over the process that way and can customize my macro organization based on sub jobs without having to write out code that checks for sub job and loads that specific group of aliases, but that could be done too.