This is actually such a good question!
👋 I wish I had found this thread a long time ago, because the issue is so important and everyone new to RPG maker should read it, to avoid later tragedies while working on their first projects.
So my short answer would be: Story and Mechanics are interwoven together and should support each other for the best experience; logically
storyline goes first in the devs head, since all the game mechanics and experience should serve that storyline (one can tell when a story has been 'improvised' just out of the blue while developing a game, and that can be very annoying),
but Database and mechanics should be the first thing to work out on the editor. That would be my heartfelt advice for a newbie, and I'd wish someone gave me that same advice when I was just starting to learn MV.
😅 When I first learnt about RPG Maker (relatively recently) I was so excited that I immediately started to draw maps and write tons of dialogues for NPC's and such (so,
Storyline, which was already in my head for years), but working in that frentic disorganized way, it was not long before I realized my database was a mess, the skill-system was unbalanced, and many things of the like (because in that excitement I didn't give enough attention to planning, foundation, gameplay mechanics, formulae, database).
😔
So, if I could travel in time to give myself some advice
BEFORE drawing even the first map, it would be to think
first in the game mechanics (i.e. foundation, previous layout, formulae, skill-learning system, iconset, tilesets, plugins, etc) and only when all the resources, assets, music, graphics, plugins, database, abilities, formulae and everything else has been already perfectly organized,
only then start drawing the maps, dialogue, story. Because any change/mistake will take soooo much time to correct. At least that's my experience as a noob: making the game up as one goes along, without previous planning, will eventually lead to
TEARS AND DESPAIR due to the double-work and huge amounts of time invested in just correcting and re-doing all that was not planned ahead.
Basically, my experience in regard to this question is summarized by
@Yanfly here:
http://yanfly.moe/2017/01/07/comic-lets-make-a-game/