The song wasn't just a random pairing; it was a late-night creation. Gaga was finishing her upcoming album