I think it's easier to determine if the player's position when they collide with the hitbox.
For example, if their Y coordinate is less than the enemy's top edge, that means they're beside our below it, and should get hit.
Otherwise, the player is above the enemy, and can stomp on them.