Is the Hydraulic analogy of a resistor wrong? According to Wikipedia's Hydraulic analogy page
A resistor is analogous to a constricted pipe such at the one in the photo below.
Bernouli's principle tells us that the pressure in both sides would be identical in both of the wide sections of the pipe
and in the narrow section of the pipe the pressure would be lower
it also tells us that the velocity inside the narrow section would be faster than the velocity in the wide parts
But, when a resistor is placed in a circuit, the rate of electron gets lower and stays that way throughout the circuit and causes a voltage drop across it,
so when exiting the resistor, the pressure does not return to the entry pressure like it does in the pipe analogy.
so, in what way is this Hydraulic analogy of a resistor actually analogous to a resistor ?

 A: You're probably aware of this; but just to cover all the bases, in the hydraulic analogy, pressure represents voltage, flow rate represents current, and as you mentioned, a pipe restriction represents a resistor.
For starters, there's a comment in your question that should be addressed:

Bernouli's principle tells us that the pressure in both sides would be identical in both of the wide sections of the pipe and in the narrow section of the pipe the pressure would be lower

This is true; but for a real flow when the effects of viscosity are considered, the flow restriction will actually create a pressure drop, so pressure at the end will be slightly reduced compared to before the restriction.  The more restrictive, the greater the pressure drop.  This is analogous to voltage drop across a resistor.
Due to the pressure drop across the restriction, doing this with pipes will decrease the total flow rate through the pipe, the same way a resistor reduces the total current in a line.  Because there is a pressure drop in the pipe, that means you either require a greater pressure to get the same outlet flow rate, or by applying the same pressure, the flow at the outlet is less.
This is analogous to what happens with resistors in circuits.  The confusion comes from not accounting for the pressure drop across the restriction, and looking too closely at the localized velocity in the restriction, compared to the actual flow rate.
