YABU
Its not about whether you have a right to apply as the law but imo you have a moral obligation to think whether its fair to take up a senior position that you won't even be doing when theres probably 100s of women that could do it.
You're obviously massively privileged that you feel entitled to take up the position in place of someone else (maybe gasp another woman of child bearing age) so you can claim to still be in the industry. You already have a job (which you've not been at long) so its not about need and you're happy to decline so why put do it in the first place?
That's your choice but its harder to defend why women have these rights to knuckle draggers when women are making choices like this which appear like they're getting the best of both worlds. a position and time off.
These laws are there to ensure that women have equal treatment and not be disadvantaged in the job market because they are pregnant women... not so they can gain a competitive edge of over others and network.
You're possibly preventing another women from getting a permanent senior role and you can still claim to be at that level within the org when you won't have done any senior work for over a year which i think is unfair to other women.
I would have hired you because its illegal not to if you're the best candidate but I would question your ethics.
Its lawfully correct that this employer is willing to hire despite the fact you are a pregnant woman but thats not the reality for most women and many of them are still fighting for the right to be taken seriously at work.
This is just the middle class way of playing the system and typical gatekeeping. Working class women never get this level of praise when they have to apply for job while pregnant. You're lucky that you're in a position to do this and I agree with pp who said:
also think those women lower down the hierarchy will be the ones to suffer - companies may be willing to take this sort of risk for someone who has proved their value in the workplace, someone who has networked, who has got a name for turning companies around/winning big contracts etc, but lower paid workers in the same organisations won't, I think, be granted the same. I don't necessarily think it's the issue of being pregnant, but being so close to going off on maternity leave.
The facts are that you're seven months pregnant, you choose not to declare this, you got the job and now will probably work a maximum of 3 months before taking a long break, leaving the work to someone else probably by one of the poor other candidates on temp contract who will have to leave as soon as you come back even though they will have been doing the job longer and will have more experience.
It may not be illegal but its not right imo.