What you're missing is planning. Before you write a single line of code, write down what you're intending to do.
MOD DESCRIPTION: Max. 2 sentences that would capture attention of someone who's scrolling through a list of mods. What does the mod do? What differentiates it from other mods?
MOD MECHANICS: Max. 3 mechanics that the FIRST version of the mod will add. Describe each in detail and how they interact with each other. If the third doesn't interact with first two mechanics, then it should be a separate mod or added later when you've got a better idea of how it could.
MOD SYSTEMS: Describe systems the mechanics are built on. What are their characteristics. This is still MVP, so describe the bare minimum of what's needed to make the mechanics work. You can add to these once you're done with the first iteration.
Then you implement ONLY that, nothing else. If you notice "ohh but it would be cool if..." while writing code, write it down and just do the bare minimum you need to get the systems and mechanics you described. When you're done, test and fix bugs. The only allowance you can give yourself to tack on more code is when you notice "ohh but that won't work", none of "would be nice" yet.
After that's done you'll have a very mediocre mod and that's fine. You've collected a list of ideas on how it can be improved. You now get to choose which idea would improve the mod the most and implement ONLY that, writing down any extra ideas you get along the way. You rinse and repeat, feel free to use GH Issues or Jira to track the ideas, or just a simple txt file.
If any of the ideas are more complicated to implement than what you can hold in your mind at once, then you need to break those down into smaller parts or high-level pseudo code which will give you a sense of how to incrementally implement them.