It cannot return and is stuck on the Astral Plane
As described under the Maze spell, the creature is sent to an extra-dimensional pocket dimension. But note that Maze is a teleportation spell effect.
School conjuration (teleportation);
As noted under Conjuration (Teleportation):
Teleportation is instantaneous travel through the Astral Plane. Anything that blocks astral travel also blocks teleportation.
And on the definitions of the Astral Plane:
Powerful spellcasters utilize the Astral Plane for a tiny fraction of a second when they teleport, or they can use it to travel between planes with spells like astral projection.
Dimensional Lock prevents travel out or into the affected area, it has no effect on creatures already on an astral form moving through the area, but that doesn't allow a creature to be teleport to the Material Plane inside that specific area. Since extradimensional travel into or out of the area is not possible, the creature cannot be teleported back at the end of a Maze spell, regardless of what the spell says.
As also noted under the description of the Astral Plane:
These three planes have one important common characteristic: each is used to get from one place to another. The Astral Plane (although technically an Outer Plane) is a conduit to all other planes, while the Ethereal Plane and the Shadow Plane both serve as means of transportation within the Material Plane, which they’re connected to. These planes have the strongest regular interaction with the Material Plane and can be accessed using various spells.
With all that said, the creature is stuck there. There are many ways back into te Material, bit it simply wont return to that same location where Maze was cast. They must find another way back.
Note that, while Maze is a good way to get rid of a creature for a while, this combination requires two 8th level spells to be used so it can be effective. While the same could be achieved with a single Plane Shift (7th level) with will save.
Also keep in mind that this is all very subjective, and while this is my interpretation of these rules, you might find a GM that thinks this is very powerful and decide that the creature is shunt to the nearest open space outside of the Dimensional Lock (even if the spell isn't technically a solid object), or that returning from the Maze is a more specific ruling than all teleportation effects being locked. All are equally valid, as there are no rules mentioning this specific interaction or developer commentary on this specific subject.