Does a person need to do ghusl if they urinate on themselves when sleeping?

No. You just need to wash the effected area.

In fact, if you did ghusl, the ghusl has no effect, and you have to perform ablution for prayer, and if you did not, the prayer is void.