This is another long-term issue in Japan that the government has been trying to address.
There are three basic types of full-time employees: permanent employees, fixed-term contract employees and temp staff. The treatment and benefits that they receive vary, creating a kind of caste system among employees doing the same job, and it is true that women are less likely to be permanent employees with lifetime employment and all of the benefits.
Japan did change the law in 2017 to ensure that all full-time employees can take maternity leave, regardless of their employment status. They receive 67% of their salary for the first 180 days of leave and 50% of their salary for the next 180 days (I checked the exact figures).
Another way that the government has been trying to solve this problem is by urging companies to create opportunities for non-permanent employees to become permanent employees after a certain number of years of work, and so my company allows temp staff and contract employees to become permanent employees after 3~5 years. Again, these are just government guidelines, and it’s all very new, but the government is aware of this problem and has been trying to do something about it.