Congratulations on finding a workable solution for the real problem. Solving the wrong problem is extremely common.
I always write a statement of the problem down first in the form, “What do I want to accomplish?” Then work backwards from there listing all possible solutions, no matter how ridiculous.