There is actually a party structure and a “real” party for both the Democrats and GOP, it’s just they don’t have direct control over nomination of candidates at this point in time.
Historically parties held conventions, delegates would be sent to the convention and they’d huddle and pick nominees. This happened on both a local and Federal level, with local and national party organizations. In practice much of this was tied in with “machine politics”, and a few big political bosses effectively “owned” each State, and when it came to the national conventions delegates from their state tended to vote how these bosses wanted them to, so in effect the various party bosses from around the country would meet in a smoke filled back room and try to come to an agreement.
Sometimes in times when the bosses were weak or unable to compromise the delegates as individuals would have more power, and you’d often see many many ballots at a convention before the party could settle on a nominee.
Primaries have been around for a long time, and were started in response to the late 19th/early 20th century populist movement. There had been a major push for years to make elections more open, this included things like direct election of Senators, more elected judgeships, and a move away from “powerful men in smoke filled rooms” deciding who got to be candidates for high political office. While you can see the reasons for this desire, unfortunately I’d argue voters are now too involved in the process and too many offices are elected directly now that shouldn’t be.
In any case, the early primaries were basically akin to a “poll”, voters expressed preferences–but the primary was just that, an expression of preference. The party bosses were under no legal obligation to listen at all to the result of the primaries. This started to come to a head when Theodore Roosevelt decided to reenter politics and ran for the Republican nomination against incumbent President William Taft. Roosevelt was vastly more popular, and the primaries showed this to be the case. But Roosevelt was always on tenuous ground with the bosses of his own party (they only begrudgingly made him Vice President, and an assassin’s bullet raised him to the Presidency, and his personal popularity got him reelected), and Taft was their man, so Taft was the nominee. This caused great anger in the Republican electorate. Roosevelt decided to run in the general under a third party, and in terms of electoral votes had the best third party run in U.S. history–coming in second to Woodrow Wilson, Taft (the sitting President) came in an embarrassing third with only 8 electoral votes. Roosevelt probably knew he was giving the election to Wilson in a landslide since he was splitting the conservative vote in all the states where it was going to be close, but I’ve always speculated he was so incensed at his treatment by his own party he decided it was time to go down in a blaze of glory.
In the years following there was a gradual movement to make primaries a binding process for selecting candidates. But it wasn’t until the 1960s and the 1968 Democratic National Convention that the tide fully turned to binding primaries.
In theory all of this was set up by the state party organizations, with coordination by the national party. That is sort of how it happened. But to make things more complex, State governments have also injected themselves into the process. The parties historically organized the primary elections and set up the nominating rules and etc, but the States have always ran the elections themselves because they almost always piggybacked on the normal State election calendar. But over the years many States have passed laws that control the conduct of political party primaries held in the state, including things like mandating “open primaries” (meaning anyone can vote, regardless of party affiliation–and some states don’t even register voters by party) and various other things.
So the tldr is: almost all State primaries are now binding, and in all binding primaries the elected delegate has a legal obligation to vote on the first ballot at the convention to the candidate to whom he/she is bound. Changing this would require not just the involvement of State party officials, but also in many cases changes to actual State laws. A few primaries are still non-binding, and a few States still conduct caucuses, which are ran outside of the State election process, but most State party organizations that run caucuses have binding caucuses, so the delegates selected cannot get to the national convention and vote for whomever they choose.
Note that all the bound delegates are only bound for one round of voting, if a candidate fails to get the majority after the first round of voting at the national convention then essentially anything can happen (including nominating a person who has not even ran in the primary election, and who had 0 pledged delegates going into the convention.) Like they could literally nominate Mitt Romney or Newt Gingrich.
Back in the era of machine politics and powerful political bosses it’d be pretty straight forward, albeit non-transparent, as to how the delegates would be marshalled. But we’re several generations removed from that sort of thing. If we actually had a brokered convention it’d be very chaotic, in the modern era powerful party bosses don’t control things with an iron fist and there isn’t anyone in the Republican party with enough authority to just demand delegates vote for x person. There isn’t even a collective group of party officials who hold that power.
Instead each candidate’s campaign would likely start jockeying for influence and engaging in horse trading with the delegations from the largest states, and various other natural “blocs” of voting within the delegates. It’d be real ugly.
If Trump wins a majority of delegates in the first round, there is no mechanism in the Republican party from keeping him from the nomination.