Well, you'd surely have to have a much larger and stronger Hansa for that to work. IOTL, if they tried that, the Danish king would probably conquer a few of the closest cities...
Getting an expanded Hansa shouldn't be too hard - they'd have to expand beyond purely German lands, though. Copenhagen is literally "Merchantsharbour" etymologically, so one could see the city becoming part of the league, rather than its enemy.
Also, get them to actually be a federal entity with federal taxes and military (rather than a rather loose league of city-states).