This is exactly yak shaving as well.
The Urban Dictionary [1] defines it as: "Any seemingly pointless activity which is actually necessary to solve a problem which solves a problem which, several levels of recursion later, solves the real problem you're working on."
So it is a perfect fit for what you described.
[1] https://www.urbandictionary.com/define.php?term=yak+shaving