The DNC and RNC are corporations. There aren't any laws that require them to be democratic in their selection methods. The DNC and RNC can pick whoever they want, regardless of delegate votes. Their respective boards can always override something they don't personally like, it's just considered poor conduct to do so.
The vast majority of activities in the US election system are done so by force of tradition, not force of law. As an example, there's nothing at all stopping any given representative in the electoral college from voting differently than their state's constituents. Only in some states is that activity illegal, and even in those states, they can't undo the vote, they can only send the representative to prison afterwards.