Adding another answer since this might work for you better. In your extension in hook_civicrm_buildForm do something like this. I'm not sure if this is documented anywhere but the country/state chain will do some autowiring for you if your fields are named in a special way.
function myextension_civicrm_buildForm($formName, &$form) {
if ($formName == 'The_Form_Name') {
$form->add('select', 'country', ts('Country'), CRM_Core_PseudoConstant::country());
$form->addChainSelect('state_province');
CRM_Core_Region::instance('form-body')->add(array(
'template' => 'CRM/Myextension/my.tpl',
));
}
Then in CRM/Myextension/my.tpl something like:
<tr><td class="label">{$form.country.label}</td>
<td>{$form.country.html}</td></tr>
<tr><td class="label">{$form.state_province.label}</td>
<td>{$form.state_province.html}</td></tr>
You may have to fiddle a bit but this will automatically apply the countryLimit and connect the two fields.