Team Power takes into account a large number of factors. The main part is the four troops used in battle, what level they are, what rarity, and how many traits they have. Points are also added for each kingdom you have at level 10 (since they add +1 to a stat to all your troops). The final addition is a point number based on your hero’s level, masteries and also what guild you are in (and what the guild’s statues are at, plus any active statue bonuses to stats).
Guild Wars doesn’t take into account the Team Power of an individual player when selecting them as your opponent. All the Guild matchups are decided on Monday and a random player from the guild at the rank you’re fighting will be selected as your opponent, regardless of their guild war defense team.
As far as I’m aware all stat bonuses are currently calculated into Team Power except for event boosts. Could they be included into the calculation? Probably, but I doubt it’s high on the devs’ priority list at the moment. Might be worth posting in the feature rethink thread here or under the general QoL thread here