How to prefer highway routes

After incorporating realtime traffic data, the routing algorithm seems to prioritize the trip duration even if that involves awkward maneuvers like getting off the highway and getting right back on as shown below. Even more drastic maneuvers are seen during rush hours.

Below is Google’s route of the same segment, which provides a route to stay on the highway despite the traffic, which seems more natural.

The potential solution I’m thinking of is twofolds:

  1. Create a custom model to lower the weight of highways.
  2. Increase the penalty for exiting the highways.

First, are these good solutions? I would like to know if I’m heading in the right direction. And, second, how to detect highway exits?

Motorway junctions indicate the exits from the highway like here. I tried using it in custom model like following to decrease its weighting priority, but it doesn’t seem to be recognized. I’ve also tried extending AbstractWeighting, but with no success.

{ "if": "road_class == motorway_junction", "multiply_by": 0.7 }

Is there any way of utilizing this?