I cannot see the carpets from where I'm sitting, so I have no way of commenting on their condition when you left the unit. Even if they weren't clean when you moved in, I expect that they got dirtier over the course of three years, two of which involved having a dog in the house. You would have to share the relevant information for us to comment on it.

Absent a modification in the lease, a tenant's obligation is normally to leave the premises "broom clean". If there are reasons beyond ordinary wear and tear that deep cleaning is necessary, such as stains or pet hair embedded in the carpet, that can reasonably be assessed as damage. Their knowledge of your dog and acceptance of a pet fee eliminates any chance that they can claim that they did not know about the dog or excuse your violating the lease by bringing in the dog without permission, but it does not excuse you from responsibility for damage to the premises caused by your dog.

I suggest taking good pictures of a rental unit before you move in, while it is empty, such that you have a clear record of its condition at that time. I suggest doing the same thing when you move out.

Did you complete a checklist for the condition of the premises when you moved in? If so, what did you mark as the condition of the carpets?