Dogs were essentially wolves then complete with ears that stood up tall.
Over years and millennia, humans selectively bred Dogs to have more desirable traits (like being friendlier or tamer).
Floppy ears, while adorable, were simply a byproduct of this domestication and breeding for tameness.