You seem to be under the misapprehension that kinetic friction ("rubbing") does work, while static friction doesn't. That's a heuristic that works for objects which are sitting or sliding on fixed surfaces, but not in general. The definition of work is
W = \int \mathbf F \cdot \mathrm d\mathbf x
where $\mathbf F$ is the force that you're interested in and $\mathrm d\mathbf x$ is a little bit of the distance that it moves. If the force is a constant and the displacement is all in a straight line, then the integral simplifies to
W = \int \mathbf F \cdot \mathrm d\mathbf x = \mathbf F \cdot \Delta\mathbf x
which you see more frequently in introductory classes.
In your case, the object is moving vertically. Friction between the object and the plane prevent the object from moving horizontally, so the horizontal component of the static friction force doesn't do any work. But the static frictional force also has a vertical component, parallel to the motion, so the work done by the force is nonzero. Finding the vertical component of the friction force is why the trig function winds up squared.
For a more obvious example of a static frictional force doing work, consider a conveyor belt which stops and starts, like you find at a grocery store. When you place the groceries on the belt, they're stationary and in equilibrium. When the belt starts to move, the groceries move with them. Somebody has done work on the groceries, because they have kinetic energy that they lacked while at rest.
The force which changes the horizontal velocity component of groceries on a conveyor belt is the friction between the groceries and the belt. And it's static friction, because the groceries don't slip on the belt.
When the belt stops, it does negative work on the groceries, steals their kinetic energy back, and they stop --- again without slipping.
(If the food on the grocery conveyor slipped, the delicate things would fall over, and people wouldn't shop at that store for very long.)