I don't know how close the nearest service station was or why they couldn't pull over on to the hard shoulder ... but the partner told the girl to wee in her car seat, i.e. to deliberately wet herself.
YABVU - the first sentence is where your AIBU should have stopped because you are knowingly judging a situation, that is 100% contextual, based on zero context which you cannot do fairly as all the relevant information is missing.
YA also VVVVU to suggest stopping on the hard shoulder is in any way, shape or form and acceptable option for anything other than a life or death emergency, which a child needing a wee is not.
There is also a massive difference between:
"Dad, I need a wee!"
<Said just after passing last service station for many miles in heavy motorway traffic>
"We won't get to <destination> for 2hrs and the next services aren't for another 20mins, can you hold it that long?"
"No, I'm desperate!"
"I'm sorry sweetie but there's nowhere safe to stop so you'll have to try and hold it until the services and I'll try and get us there as fast as we can. If you have an accident before we get there then don't worry, I know you're trying your best to hold it but it is a long way so if you can't hold it then it's ok. We can stop and get cleaned up if necessary but we'll try and get there as quick as we can"
Child then wets themselves, driver stops at the next opportunity to get child out of wet clothes/seat and clean up as much as possible asap
Vs
"Dad I need a wee!"
<Said just as sign appears to say the turn off to the next services is in ½ a mile on a journey where there is no time constraints to prevent a toilet stop>
"Well you'll have to hold it because I'm not stopping till we get to <destination>"
"I'm not desperate but I can't wait that long!"
"Well you'll have to try!"
20 mins later, after passing multiple services/rest stops
"Dad, I'm really desperate for a wee now, I can't hold it any more"
"I told you, I'm not stopping until we get to <destination> so you'll just have to hold it for another hour or wee in your seat, either way I'm not stopping!"
Child then wets themselves and is forced to sit in wet clothes/seat for the next hour despite multiple opportunities for the driver to stop and let them get cleaned up
The former situation is perfectly understandable - the driver is in a situation where they cannot stop immediately, they have acknowledged that they know there is a risk of the child having an accident in the car but has reassured the child that they know it's a possibility and they're not going to get mad at them whilst trying to get them to hold on as long as possible so they can find somewhere safe to get off the road. They have also made it clear that they will stop at the next services regardless so that the child can either use the toilet or get cleaned up for the rest of the journey.
The latter situation is totally unacceptable as the driver has multiple opportunities to stop but chooses not to and humiliates the child for no reason other than they don't want to stop the car.
From your OP we cannot ascertain which of these situations you are describing and therefore YABU to ask people to judge the situation out of all context.