Ok, cleaned up the mess, disabled new account creation, for the moment. Due to WikiMedia woefully inadequate tools, for cleaning up a mess like this, I rolled back to a backup from yesterday. It would have taken weeks to manually clean it up.
It is quite possible for some of the templates needing to be reworked. I had to work on the primary one to get it to work again. The upgrade process was not the best I have seen, but then again, we waited far too long to do this.
It may take some time to get it all back together again. Any help anyone wants to provide would be very welcome. We cannot go back to the old version.