Just like building a house, work on framing first, then put up walls, then hang stuff on walls. Don't get too caught up on the stuff you want to put on walls before you even have walls, it's okay to think about it but don't let that slow you down. It might be easier to see where you want to hang your picture frames when everything else is in place. Likewise in music work on the foundations: getting through the piece, consistent rhythm, line. Playing without mistakes is an ideal, but we don't need an ideal to achieve effective practice. It is more important to be working in the right direction than to be perfect all the time.
I'm going to take an opposite approach here. I think spending a lot of time on small parts is a good way to practice. You could go learn the entire piece with just the notes and rhythms and then come back to the dynamics, articulations, etc. but then you are basically learning the piece twice. Not to mention you have already ingrained the unmusical habits into your playing.Instead spend a lot of time from the beginning practicing everything correctly, just like you're doing. It may take longer to get through the whole piece this way, but when you do get through it, it will be learned correctly and there won't be a need to go back and relearn it with dynamics etc.
[...] but then you are basically learning the piece twice. Not to mention you have already ingrained the unmusical habits into your playing.