Limit post top level categories to one

Late answer but I figured I’d throw in my idea since I had a similar problem recently.

Basically I did this by injecting a script into the editor views. My function looked something like this:

(function() {
    var o=function() {
    //add a click handler to category checkboxes
    jQuery("#categorychecklist input").click(function() {
        //get top-level category (in case child is checked)
        var tlc = jQuery("#category-all>ul>li").has(this);
        //if top-level category is not checked, check it
        jQuery(">label>input",tlc).prop("checked", true);
        //uncheck all boxes from other top-level categories
        jQuery("#category-all>ul>li").not(tlc).find("input:checked").prop("checked", false);
    });}
    //run this function onload
    var n=window.onload;"function"!=typeof window.onload?window.onload=o:window.onload=function(){n&&n(),o()};
})();

I hope this helps somebody. To add a script just use something like this: How to enqueue scripts on custom post add/edit pages?