Don't split your codebase. Just add some flags if it is self-hosted or not. Devs here will cry and tell you you can't do that and people can bypass it. Really don't listen to them. 99% of the people who purchase your SaaS instead of self-hosting do it because they don't want the hassle. The rest won't buy from you anyway. The biggest problem is getting SOMETHING out there. If you have success (which let's be honest most likely you won't), you'll have enough time building a better solution later. So keep it simple.
This is precisely what Adobe's model was up to Creative Cloud. Probably tens if not hundreds of thousands of young people, school kids and students, grabbed the CS5/6 keygen off of some warez site, taught themselves how to use Photoshop, and asked later employers to provide them with Photoshop.
Nowadays, it's not the case any more as the 20€ or so a month are affordable for a lot of people.