If you only have a vague idea of what the product will be (or at least what the real problem to solve is) and you don't have any potential buyers to talk to then you really shouldn't be writing a single line of code at all. You should be building your network and experience so that you do understand those things, then you go and build an MVP. So many developers fall into this trap.
I always recommend the book The Mom Test to would-be entrepreneurs. It goes into more detail on why asking people if they will buy something is worthless (as you mentioned), and how you can ask much better questions to find and validate problems worth solving.
+1 on recommending the Mom Test, it's one of the most important books I've read.
I'd say in addition to entrepreneurs, it's an important book for product teams / product engineers to understand what the Mom Test teaches, and tune the filter on asking the right questions to get the highest signal, and ensure the solution closely matches the value prop for the customer. Then sales and marketing get a whole lot easier when you've asked the right questions and solved the right problems.
I always recommend the book The Mom Test to would-be entrepreneurs. It goes into more detail on why asking people if they will buy something is worthless (as you mentioned), and how you can ask much better questions to find and validate problems worth solving.