As long as you're doing what you agreed in your contract, it doesn't matter. It's only a problem if the job performance suffers due to your startup.
Company doesn't care about you, that's the reality you need to be aware. Most companies will respect their obligation they took from their side of the contract, but the moment they don't need you anymore - you're done, fired. Everybody needs to be ready for this scenario. It will happen to everyone, at least once in their life. The best way to protect your self from this is to have some other income on the side. Either investing in your own startup or something else. You owe to your self that much.
If you have no other need for the money, I don’t think it’s an issue of morality but rather efficiency. Don’t take the job - better to spend time improving the startup and finding investors.
And if you do have non-startup expenses well then this conversation is a non-starter. You need money to live. Doesn’t matter if you treat the job as only temporary.
It only feels like a gray area If you plan on leaving in less than two years, many people would even say less than one.