Product of slopes of two lines which are perpendicular = -1, is derived from the angles these lines make with x axis.
If we take x axis and y axis alone, this is not applicable as the angle made by y axis with x axis = 90 and tan 90 is not defined. Hence, this identity is cannot be applied in this case. In fact, there is no need to do so, since it is clear that the axes are perpendicular to each other.
It is only in case where lines are differently inclined with x axis, where you need to find the condition for them to be perpendicular to each other.