I've covered multiple maternity leaves or temporary roles between someone getting fired and a new director being pulled in.
It sounds like most of the ones I managed where you make some slight changes based on making it more efficient or due to changes that occur in the year only for them to return and get their feathers ruffled.
For me I knew it was a temporary job and that they would probably try to undo the processes I put in.
In one job IT were completely changing the system so all images are going to be removed. Because of the lady I was covering had bad habits I worked with them to ensure that we had created a system even they would agree on. If she had been there though when this had occurred... They probably would still be arguing about it now all these years later. She was annoyed when she got back but it was that or no images.. Which as a head of marketing is not possible
Another I covered where head of marketing got fired and they had to wait 6 months for a new director (they also had a restructuring going on) so I was hired to act as temporary Head until the new director started. The department was a mess so I changed everything and ended up taking the team from very low esteem to highly efficient, creating award winning campaigns and very happy. New director was hired thinking that the department would be a mess so lots of things to improve and lots of easy wins.
She undid lots of my processes while I was still handing over in a bid to win over some brownie points with other staff out of the department which only caused problems and upset.
I find a problem with the budget she had implemented while still technically under my management... Tell finance and my contact was cut short by a month. Two days after I'm gone the team is in chaos as they haven't been properly handed over but also she's breaking processes to protect them from stupidity from other teams (such as demanding a poster when we have no details of content, budget, size, etc or even not providing minium times to be created instead allowing them to demand instantly again despite the work load).
Within two weeks ago but one member of the team quit.
Another told me to change anything and everything as I pleased but never returned.
Another role told me that I couldn't make any changes despite that being the whole point I was there. Top boss found out and I got to start making changes. She enough it helped but I know a year on they went back to their old ways when the boss was focused on other parts of organisation with a big project.
Some people are great but with these roles most people tell you they are happy with you making changes to make it easier for you but they feel their role has been invaded when they return or even start.
It is hard to explain to people that when you say "this is the way we do things now" is not how you actually put it but it is far easier than trying to explain to mn the conversations that you did have around "so we made these changes and it made things better". With going to the top boss, yes that may have been a negative move but after managing a team, trying to turn off that protective gear of standing up for them or having that direct line can be hard. They are used to you now being that person to go to with their issues or to stand up for them.
As others have said, take this as a learning experience and look for a new role elsewhere. You are only going to get stressed out by it. I learnt to do that after a while, and that is even with leaving.
You did your best, you learnt alot and for a while you made life far easier for them. Those people now know there is a better way and without you there, they might be able to champion that change or use that when they also move on.
This is why maternity covers that come and leave are often better - they almost always return and they will want some security of their job back than feeling like someone else waiting in the wings who may or may not have been better.
Good luck with the job hunt - it is going to be best for you and your returning member of staff to try to grow but move on from this.