You can do what you want, safely, but it requires the use of items which are out of the ordinary.
The problem you have to solve is that the cable to the shower is protected by a large MCB - 45 or 50A is not uncommon, but even a small shower is likely to be 40A, and that is way too big to protect the 1mm² or 1.5mm² cable you've used for the fan. If you could wire to the fan in 6mm² or 10mm² then you'd be OK, but you'll struggle to get 2 cables that size into the terminals of the switch. So you end up needing some kind of junction box for the cables, which can be done - TLC sell a 60A JB with terminals that will take 2 x 10mm² cables. Then you need to go from there to an FCU (or two if the fan is a timed-overrun one) in 6/10mm², and then to the fan in1/1.5mm²
I've got just such an arrangement of a fan switched by the shower, but instead of a junction box I used DIN-rail mounted connection blocks and a fuseholder, and a contactor so that I could use the lighting circuit to supply the fan:
It actually didn't get built quite according to plan, as I didn't have enough space on the rail for a block for the fan neutral, but as the contactor was a DP one, I was able to use one of its terminals instead.
Under construction:
(can you spot the deliberate mistake?
)
All installed. No way to get the items to sit upright on the rail:
But when the cover is in place you can't see them.
(The cover, BTW, should have a warning label about it being fed by multiple circuits. I'll stick one on sometime....)