Seperation was ensured because the restriction was issued before takeoff,
After departure maintain 4000ft.
.
There is step climb in the SID of 4000A, the cleared level is 5000A, as that is the end level on the SID. Therefore, the clearance issued was absolutely correct and absolutely necesary to ENSURE separation.
Unless otherwise cleared, a pilot should follow the vertical profile of the SID, regardless of whether or not it is NORMALLY ammended (subject to the safe control of the a/c which the Pilot is responsible for.....). Only if a positive ammendment is received should the SID be disregarded.