I think you're mixing up logo and icon.
A logo doesn't have to be a square. There are several examples of famous non-square logos.
But an icon should be square. It is mostly used as gravatars or also favicons (the small images in the browser tabs).
But there is a strategy to design your logo similar to your icon. That means that your icon is also used in your logo. So the icon will be recognized to your logo.
As example Microsoft or also User Experience or Stackoverflow:
Or just look at the User Experience logo on this site and then on the favicon on this site.
The icon will be assigned faster than when the icon is different to the logo.
But also in this case there are some famous examples, e.g Google or Dribbble:
A lot of people were already on dribbble and would recognize the logo but not the icon. Same as google. Some (mostly older) smartphone users are confused about the g app, because they don't recognize google in it.
I give you the advise, design your logo as you want and try to design a similar icon for your logo.
A last example of a typographic logo / icon design by yahoo:
Last but not least, an article about the "square icon" for you by tweakyourbiz.