Just double checking.
Have you tried inserting a pair of earphones into the earphone socket first to verify that you can still hear OK and then to check that if you remove them from the socket that the headphone socket icon disappears from the screen and the phone returns to its normal audio mode?
If this does work then you have been lucky as I think that the headphone socket is still faulty but is back in a working condition. I suggest that you don't use it again until it is fixed. If you wish to listen to music etc try Bluetooth headphones as an alternative
If it doesn't workyou still may have a faulty headphone socket. There is a contact within the socket itself that is operated when a headphones' plug is inserted to inform the audio controller in the phone to redirect the audio away from the receiver (or loudspeaker) and onto the headphone socket. This contact releases when the plug is removed. It is either stuck or bent out of shape and cannot return to its' normal position. The socket cannot be repaired and will have to be replaced.
Here is a link to the ifixit ZTE ZMax Pro (Z981) Disassembly guide. At Step 8 you can access the headphone socket so that it can be replaced.
(click on image to enlarge for better viewing)
To replace the socket you will need to have the necessary SMD (surface mounted device) soldering expertise and tools.
I couldn't find a replacement socket for your phone online but I did find this as a possible option if you decide to do the repair yourself. It would most probably be cheaper than if you went to a reputable, professional mobile phone repair service and got them to replace just the socket. (They most probably would have better access to comparable spare parts)