Can we count the number of times a particular state in a DFA is running in a loop?
First of all, let me mention that the definition of DFA is final. The definition specifies everything that counts as a DFA. If you modify the model, it is no longer a DFA. However, your question makes sense if we interpret it as trying to change the model while keeping the class of languages accepted by the model.

There are several ways to interpret counting. If you could keep track of the number of loops through a state and then still remember it when you exit the state, then (depending on your exact rules) you could accept the language $a^n b^n$. So any mechanism that allows this is ruled out.

Another interpretation is that the state keeps a loop counter $C$, and it can base its decisions on the value of $C$ (that is, allow the transition function to depend on the auxiliary information $C$). This is also too powerful – you can accept every unary language (i.e., a language over $\{0\}$) using this mechanism.

What if we just allow the state to remember some information about $L$? Say that we partition $\mathbb{N}$ (the natural numbers) into finitely many sets $S_1,\ldots,S_d$, and we want to allow our transitions to depend also on which class $C$ lies in (here it doesn't really matter whether we are counting how many times we were at a state overall, or in the current run).

Let's do the case $d=2$ first. We can think of this as defining a unary language $L$ (which we identify with a subset of $\mathbb{N}$), and allowing transitions to depend on whether $C \in L$ or not. In this case, the resulting automaton model (for some fixed $L$) remains equivalent to DFAs precisely if $L$ is regular (exercise).

The general case is similar, and left to the interested reader.