Not always. One good example is the food web around a hydrothermal vent. In the vent system, bacteria use chemical energy from hydrogen sulfide to produce sugars without any sunlight (no photosynthesis). Then, some animals (e.g., zooplankton) around the vent feed on the bacteria (primary consumers), while others feed on the primary consumers (secondary consumers). Here is an example activity that touches on this food web.
Source: https://prezi.com/enzc3iqcvizk/hydrothermal-vent-ecosystem/
To add something about primary consumers being any organism that feeds on producers. The whole idea of classifying consumers is a bit bogus. Classifying producers is way clearer because you can clearly look at photosynthetic or chemosynthetic organisms and go from there. The way that we can look at consumers is based on their $\delta
^{13}C$ (en.wikipedia.org/wiki/%CE%9413C) and $\delta ^{15}N$ (en.wikipedia.org/wiki/%CE%9415N). As you move up trophic level, your proportion of $\delta ^{13}C$ and $\delta ^{15}N$ increases.
Even for humans, depending on how much meat you eat you get different signals (e.g., pnas.org/content/117/33/20044, Figure 1). In your case, the omnivore will have a signal that includes higher $\delta ^{15}N$ values because of their feeding on other animals and therefore they will be classified as a secondary consumer.
In order for omnivores to be classified as a primary consumer, their $\delta ^{15}N$ should be close to the one for producers or better to organisms with a complete "vegetarian" diet. That is not the case for omnivores.
In a lot of these cases, there is a gradient of values of $\delta ^{15}N$ depending on the diet of the specific omnivore. In fact, scientists look at the $\delta ^{15}N$ values of different individuals to determine their eating habits and in some cases where in the habitat they are feeding. There is a lot of variability on this depending on organisms and even life stages. Classifying organisms as primary/secondary consumers misses the nuance and oversimplifies the complex food web that we observed in the environment.