A very common programming case is "I need a second, slightly different version of this thing", which creates an immediate temptation to build a shared abstraction.
IMO the better approach is to copy paste the whole thing, modify and get it working, and then decide if you need it.