I think the answer to your can they is yes, since they did. Not sure what happened at trial, and yes both claims can be tried together if jury trial was asked for by either party. It would seem very unfair for you to be responsible for work that does not pass code and does not have appropriate permitting. The fact that it was done by anunlicensed person is less of a problem. Did you handle this case on your own? It seems like the time has come to get an attorney who can properly convey your legal arguments the Court. The Court can still rule in your favor on the law if the tenant failed to prove up its claim from a legal standpoint. Apparently whatever you have done to do date has not conveyed your arguments. It is now time ot change.
If you did not have an attorney you need to get one immediately. The tenant may be liable for 'waste' which could offset the quantum meruit claim that he is asserting. Did you give the tenant permission to renovate the property? If you do not already have an attorney you may contact me to discuss this matter email@example.com
No attorney-client relationship is created by answering questions in this public forum. If you wish to create an attorney-client relationship, you must contact me directly and sign a representation agreement. Answers are provided based on general ideas and an answer specific to your situation would require a review of all documents.