It’s just how the industry works. It’s competition. It’s because airlines charge based on O-D, and not based on intermediate points you are laying over at. It’s their business model. It’s how they make money. It’s price discrimination based on various factors.
LAS-LAX almost certainly has more competition than LAS-MGA - they want to be able to provide lower fares to those going to LAX to make it work and compete with other carriers on that route, while they don’t provide that same discount to those who happen to be transiting in LAX going to MGA. You can get the $49 from the flyer going to LAX, who otherwise might fly a different carrier for $50 if UA charged more, but charging the guy going to MGA $100 for that segment to make a profit (or a better one) since they can get the premium since others are also [likely] charging that higher amount to MGA.
you may be able to skirt around this by trying to search as a multi-city itinerary, searching for LAS-LAX, LAX-MGA, MGA-LAS - it may (or may not) provide the lower price you want - sometimes the site does not check married segment rules (at least, it sometimes hasn’t in the past) which might result in a lower (or sometimes, higher) fare then searching as a round trip.
Also, assuming you are trying to book one way, there are likely different rules in place - LAS-LAX likely offers one-way fares at lower levels, while MGA likely requires a round trip to get the lowest fares.
The industry and global systems used also do not allow PNRs to be ‘combined’ - UA will often protect you if you ‘misconnect’ on two separate UA itineraries, but note this is always going to be a favor, not required. If you book separately, there are risks - including an uphill climb if say, LAS -LAX gets canceled, and you want to re-route with a different ‘connection’ to MGA.
oh, and the fare system you ask about is also the same reason you can fly LAS-LAX for $49 in mid-June (presumably each way), while when I want to go SFO-LAX (only about 100 miles longer than LAS-LAX) , I can’t find anything lower than $200.