Hemorrhoids, strain. Constipation or forceful straining with bowel movements without relaxation of the anal sphincter is the most common cause of flattened stools. A rectal exam should always be done to exclude and anorectal mass.
Hemorrhoids. All of the things you mentioned along with hemorrhoids can change the stool appearance. If you see changes get yourself a proper evaluation to avoid the more serious problems that can cause this.