The B-17 was originally designed as flying Coast Defense Artillery. The USN immediately moved to limit how far out to sea the USAAC could attack ships.
You are right. High level bombing had little success against maneuvering ships in WWII. But nobody knew that then, including the USN.
From what I’ve read, the Navy turned out to be right. B-17 turned out to pretty poor in the role it was designed for—attacking/sinking ships.
The "Flying Coastal Defense" meme was just a story cooked up to get funding for a four-engine bomber. But yeah, the Navy hated the idea. They tried to get it killed on the theory that an aircraft could never locate a battleship at sea. Despite the Navy's having cheated in a number of ways, Curt LeMay, flying as a navigator, proved them wrong. Oops!
B-17 worked ok but it took until late 1942 when the 5th Airforce in the Pacific figured out how to do low level skip bombing with them. At high level trying to hit ships was a waste of effort. As far as I know they never hit a ship that way