Do AI base their unit composition off of what you have?
Not really, no. They will build counter units as mentioned, but ultimately what comp they run has to do more with what (if any) resources they have available, how long they've had a strategic resource or keystone military unit tech, and simply weighting being higher on certain units (AIs will tend to build things like archers or longbows more as these are defense units and they love to spam them for garrison and in response to threats).
Some examples:
-an AI with early horse but not copper will tend to have more chariots and horse archers
-AIs
will whip spears/pikes if you are using only mounted, or Axes if using only Swords, etc. They will still primarily spam archers and other resourceless defense units though.
-even if an AI has Gunpowder (most common one I see) or MilSci/Rifiling, they will stay on mostly longbows until some time passes
and so on. A thing about the "keystone tech" point is that AIs at war will more readily upgrade their units, so that can lead to the "magic rifles" thing where a ton of lower defenders are suddenly being upped to their highest available tier. It happens a lot with HAs/Knights/Cuirs too.
Also as a followup question, does opening borders give AI info to decide if they should DOW?
Mechanically, no. The AI already has access to all it needs to know from the moment it meets you whether it *can* declare on you. It's just waiting on a random war check and then it will start evaluating targets for eligibility. It's even possible for an AI to plot on you immediately after meeting you even if it (thinks it) can't reach you! Another surprising thing that can happen is an AI that is already plotting when you meet them (but not at war yet) can swap targets to you upon introductions.
Opening borders can give you something of an early warning system in some cases, as AIs will occasionally move units around in your territory when plotting, especially if you have locked them into a peace treaty before they would have DoWed.