uninstall a theme programmaticlly

  1. The limit of the child theme is not a border from WordPress, maybe your webspace.

  2. If you remove the directory of a child theme, include all files, if is deleted. For the delete of the folder use rmdir().
    The method rmdir() is part of the classes that extend WP_Filesystem_Base, like WP_Filesystem_Direct and accordingly the rmdir() method in that class. Take a look at the the wp-admin/includes directory to inspect the other classes yourself.