Population genetics of pan-genome
It is possible to perform gene-level population genetics analyses on microbiome-derived bacterial species.1,2 † However, the biology of bacteria and the nature of metagenomic sequencing data make such analyses difficult and intractable to many of the well-worked tools of population genetics. Here are some of the things you should keep in mind as you build a conceptual framework for understanding the field:
Bacterial genomes are flexible
The term &quot;allele&quot; connotes gene variants, and the underlying assumption of analyses involving alleles is that each (diploid) individual in a population has one or two alleles of a given gene.  When considering a bacterial population, specifically all the cells that constitute a species, some genes will not be present in all cells. For this reason, &quot;allele&quot; is not frequently used in discussions of complex bacterial communities.  For well-studied species like E. coli and K. pneumoniae with many complete strain genomes, plotting the number of genes found across genomes gives a characteristic U-shaped distribution.3  For a given species, this suggests that many genes are present in most strains, and many genes are present in only one or two strains.  The simple thing to do is to constrain your analysis to the gene set that you observe to appear in all ‡ individuals in a population (the core genome, to use a pangenomics term), but this likely excludes genes that are important for niche-specific fitness like virulence factors, antibiotic resistance genes, carbohydrate degradation operons, etc.  Recently, this problem has been addressed computationally by representing pangenomes as weighted graphs with genomic features at nodes 4 and by building composite reference genomes from strain genomes data encoded as reference graphs.3 #
Metagenomes are messy (but getting cleaner!)
Horizontal gene transfer is likely a frequent occurrence in microbiomes,5 confounding analyses that rely on strict inheritance. Since microbiome sequencing is often short-read, the problem of horizontal gene transfer is exacerbated by the difficulty in reliably assembling transferred genes with specific metagenome-assembled genomes.  As noted by Maximillian Press, there are several ways to address this issue. At the bench, proximity ligation sequencing can supplement traditional metagenomic assembly-by-alignment using the ground truth of physical closeness.5,6 Likewise, single-cell isolation combined with multiplexed whole-genome amplification greatly reduces complexity of assembly.7  At the computer, sequence composition (i.e. kmer content) and coverage profiles can be leveraged to associate metagenomic contigs in bins,8,9 which are like pseudo-genomes.§ If you're lucky enough to have long-read sequencing data, many of the problems associated with assembly of short reads are no longer an issue,10 with the added bonus that SMRT and nanopore sequencing produce methylation data -- unique methylation profiles can be used to infer which contigs likely belong to the same genome or to associate extragenomic contigs (e.g. plasmids) with their hosts.11,12  All of this to say that getting complete genomes from microbiome sequencing is non-trivial, but there are many techniques and tools at your disposal.
Microbiome data is relative
Much of population genetics deals in counted data -- $n$ individuals with allele $a$, $m$ individuals with allele $b$, and so on. Concerning microbiomes, the absolute abundances of individual microbes are not recoverable from sequencing alone. Microbiome data is therefore said to be compositional.  Like RNA-seq, gene or organism abundances derived from metagenomic sequencing are relative, and, importantly, many of the assumptions underlying the statistical analyses applied to absolute counts do not hold for compositional data.13,14  Thankfully, statisical tools for population-level analysis of microbiomes have been developed,15,16 though their widespread adoption has been slow.
Microbiome members are often interdependent
As hinted at in the question update, bacteria display a type of community altruism, where an individual cell with a specific gene can influence the fitness of neighboring cells that lack the gene.  For an example, see my answer to Will all bacteria become resistant against all antibiotics in the long term? concerning secreted β-lactamases.
Therefore, spatial association is an added factor when considering population dynamics of a genetically heterogeneous bacterial species.  Some methods that address cell-cell spatial proximity in microbiomes include sequencing of cryofractured fragments 17 and probe-based spectral imaging.18 Even if microbes are not spatially associated, different microbes may play complementary roles in the iterative metabolism of large carbohydrates into small metabolites.19,20
Surely, this discussion is incomplete, though I hope my answer has given you the footing you need to continue your own exploration to find the appropriate resources for your research.  For a more in-depth discussion of the points I've addressed here, see What Is Metagenomics Teaching Us, and What Is Missed?,21 particularly the sections titled Strain-Level Analyses and Ecoevolutionary Modeling.

† I recommend keeping up with the publications of Ran Blekhman, Peer Bork, and Katie Pollard.
‡ Core genome membership seldom requires that 100% of individuals represented by that genome contain the gene in question, and setting such a strict cutoff would likely exclude truly essential genes that were not found associated with a given strain due to gaps.  In practice, core genome cutoff thresholds are on the order of 90%.
# The senior author for reference 3 made a great explanatory Twitter thread.
§ Contigs and Bins and MAGs, oh my! As with any field, metagenomics has field-specific jargon. Coursera seems to have a good lecture that includes these concepts and how they relate to eachother.

References

Garud NR, Pollard KS. Population Genetics in the Human Microbiome. Trends Genet. 2020 Jan;36(1):53-67. doi: 10.1016/j.tig.2019.10.010.
Priya S, Blekhman R. Population dynamics of the human gut microbiome: change is the only constant. Genome Biol. 2019 Jul 31;20(1):150.
Colquhoun RM et al. Nucleotide-resolution bacterial pan-genomics with reference graphs. bioRxiv 2020.11.12.380378.
Gautreau G et al. PPanGGOLiN: Depicting microbial diversity via a partitioned pangenome graph. PLoS Comput Biol. 2020;16(3):e1007732.
Kent AG et al. Widespread transfer of mobile antibiotic resistance genes within individual gut microbiomes revealed through bacterial Hi-C. Nat Commun. 2020 Sep 1;11(1):4379.
Stalder T et al. Linking the resistome and plasmidome to the microbiome. ISME J. 2019 Oct;13(10):2437-2446.
Chijiiwa R et al. Single-cell genomics of uncultured bacteria reveals dietary fiber responders in the mouse gut microbiota. Microbiome 8, 5 (2020).
Alneberg J et al. Binning metagenomic contigs by coverage and composition. Nat Methods. 2014 Nov;11(11):1144-6.
Kang DD et al. MetaBAT, an efficient tool for accurately reconstructing single genomes from complex microbial communities. PeerJ. 2015 Aug 27;3:e1165.
Kolmogorov M et al. metaFlye: scalable long-read metagenome assembly using repeat graphs. Nat Methods 17, 1103–1110 (2020).
Beaulaurier J et al. Metagenomic binning and association of plasmids with bacterial host genomes using DNA methylation. Nat Biotechnol. 2018;36(1):61-69.
Tourancheau A et al. Discovering and exploiting multiple types of DNA methylation from individual bacteria and microbiome using nanopore sequencing. bioRxiv. 2020.02.18.954636.
Tsilimigras MC and Fodor AA. Compositional data analysis of the microbiome: fundamentals, tools, and challenges. Ann Epidemiol. 2016 May;26(5):330-5.
Gloor GB et al. Microbiome Datasets Are Compositional: And This Is Not Optional. Front Microbiol. 2017 Nov 15;8:2224.
Shi P et al. Regression analysis for microbiome compositional data. Ann. Appl. Stat. 10 (2016), no. 2, 1019--1040.
Kurtz ZD et al. Sparse and compositionally robust inference of microbial ecological networks. PLoS Comput Biol. 2015 May 7;11(5):e1004226.
Sheth RU et al. Spatial metagenomic characterization of microbial biogeography in the gut. Nat Biotechnol. 2019 Aug;37(8):877-883.
Shi H et al. Highly multiplexed spatial mapping of microbial communities. Nature. 2020 Dec.
Kundu P et al. Species-wide Metabolic Interaction Network for Understanding Natural Lignocellulose Digestion in Termite Gut Microbiota. Sci Rep 9, 16329 (2019).
Selber-Hnatiw S et al. Metabolic networks of the human gut microbiota. Microbiology. 2020 Feb;166(2):96-119.
New F, Brito IL. What Is Metagenomics Teaching Us, and What Is Missed? Annual Review of Microbiology. 2020 74:1, 117-135.