The behavior you described might be a form of what's known as "symmetry" or "just right" OCD, which is a subtype of Obsessive-Compulsive Disorder.
People with symmetry OCD often feel a strong need to create balance or symmetry in their actions or thoughts. This can manifest in behaviors like touching one finger with their thumb and then feeling compelled to repeat the action with the other fingers to achieve a sense of equilibrium.
However, it's important to note that self-diagnosis is not reliable, and only a qualified mental health professional can make a proper diagnosis. There are various other factors and conditions that could lead to similar behaviors, and they may not necessarily be related to OCD.
If these behaviors are causing distress, interfering with your daily life, or you're experiencing other symptoms that concern you, I highly recommend reaching out to a mental health professional. They can conduct a thorough evaluation, provide an accurate diagnosis, and offer appropriate treatment or coping strategies if necessary. Early intervention and support are essential for managing any potential mental health challenges effectively.