BDD presents an approach that might be useful: A user story is fleshed out with scenarios/examples. These scenarios are both human-readable specification and executable tests of behaviour. Each scenario is then small enough that it can be counted.
There will still be considerable variability for the effort between scenarios, but by packaging them into small unambiguous scenarios the risk of unexpected variability is reduced.
TBH I think the variability between scenarios will still be so large that it's not practical to simply count them. In particular, the first few scenarios of a story will see more effort for infrastructure from which later scenarios benefit.
It should also be noted that by breaking a user story into small testable scenarios, we are front-loading a lot of the risk. This is arguably good, in the sense of failing fast. But breaking stories down is also a lot of the effort of implementing a story. This gives rise to the meta-question: which story is worth breaking down next? How much effort would breaking down this story or that story be? Estimating that preparation is of course simpler than estimating the whole implementation of a complete story, but in a sense we are merely trading one approach to estimation for a simpler approach with less fidelity.