Germany needed a blue water navy for defensive purposes. They needed to 1) defend their colonies, and 2) defend their trade routes. Only the third reason for having a navy could be met by the u-boats - disrupting enemy trade routes.
Without an effective blue water navy, the Germans were unable to defend their colonies nor to maintain their trade routes.
The Germans were able to launch a series of coastal raids in Europe, but were unable to maintain their colonies nor trade routes.
The Germans could have constructed a different type of navy for maintaining communications with their colonies. Emphasis on the Light-Cruiser type would have done that job efficiently without frightening the Brits.
But, what about their colonies and trade routes?
Once countries get caught in an arms race their acquisitions tend to get out of hand. I don’t think England or France was going to poach Germany’s colonies, and the Germans didn’t need to build a navy that could potentially challenge Britain’s naval supremacy to deal with local colonial insurgencies. Building a navy that was big enough and powerful enough to take on Britain was precisely the one thing that would win Germany Britain’s enmity.