>>34606497When a Pokemon gets generated, it rolls a number that is then stored. To define the gender, this number is compared to the gender ratio and the result is displayed. This number is stored in the Pokemon's data and doesn't change; There's nothing else that defines the Pokemon's gender but the comparison between this number and the ratio. The game does not store a simple male/female number because under normal circumstances just comparing the roll to the ratio is enough and it'd be a waste of time and space.
If i recall correctly, they gave Azurill a different ratio than Marill, so while the rolled number would fall on male for one, it might fall in the female range for the other.
tl;dr they fucked up. Either they simply didn't use the correct ratio, or wanted the baby to have a different ratio for flavor purposes but were too stupid to realize that it'd be "reverted" once the Pokemon evolved.