Hydrogen production by electrolysis is relatively efficient, with 80% efficiency regularly achieved by modern electrolyzers. It's the reverse reaction that causes problems; 60% is very good for a fuel cell.

So you can avoid the issue if you can use hydrogen to do useful work directly. The simplest cases are iron reduction from ore and heating via absorption heat pumps. Iron reduction works pretty well, but absorption heat pumps have limited exergy efficiency (a measure of useful energy available in heat) when using a very high temperature source like a hydrogen flame. An alternative is to use the waste heat from a fuel cell to drive an absorption heat pump, effectively converting hydrogen to both heat and electricity, the latter possibly being returned to the grid or a battery. But this creates a complex system of energy distribution, which requires some fancy load balancing on the electrical side. District heating allows you to avoid having a fancy fuel cell in every residence, but it requires infrastructure.