Judging by my own side projects, there seem to be two varieties: scratching your own itch, or scratching someone else’s. In the former case, marketing really does come later because you already have a perfect user to consult on product design (yourself) and just need to find other people with the same problem you have.
The latter case is when marketing is a lot more integrated with building the product. If you’ve made it all the way to a public release but don’t really know how to market, then there is a dangerously high probability that you built something nobody really asked for.