Another option would be to look at "if I moved the capital here, how much would I save in maintenance costs right now".
Then balance that against the hammer and turn cost of moving the capital.
The benefit of that approach is that it would both pull off the 'move continents' and the 'move within continent', and also teach the AI not to move the capital if you have a low distance-from-capital maintenance.
Finally, you could factor in the bonus commerce from things like bureaucracy in an organic way. You would see the AI moving capitals to kick-ass cities when they switched to bureaucracy quite often if written right!
The what-if would go something like:
1> Calculate the "distance from capital" currently.
2> Calculate the commerce at the capital currently.
3> Do the same for the new capital.
Work out a 'value' for hammers, and a delay-cost threshold multiplier (ie, don't move the capital to a city with 2 hammers, even if it is in the best location possible). If the price of the hammers is low compared to the amount saved per turn, move the capital.