We used to watch the Danny Thomas show back then, and they had an episode where Danny gets stopped in a small town by Sheriff Andy.
I am not sure if it was intended to introduce the Andy Griffith show or that they just liked the idea of that episode and decided to make a new show.
I do know the first two or three episodes they had Andy as the comedian then very wisely changed him to the straight man with the other characters playing off him.
The Danny Thomas episode featuring Sheriff Taylor was the de facto pilot for the Andy Griffith show (Mr. Thomas was one of the executive producers, along with Sheldon Leonard).
You are also correct that the series originally envisioned Griffith as the “funny guy” with Don Knotts playing straight man, much as they had on Broadway in “No Time for Sergeants.”
To their credit, Griffith and the writers quickly realized the potential in Barney Fife and made Andy Taylor the straight guy. It was one of the smartest decisions in sitcom history; Griffith’s rambling monologues didn’t work well in a 30-minute show and Deputy Fife (as played by Don Knotts) was pure comedic gold.