I tried with luadraw
\documentclass[12pt]{standalone}
\usepackage[svgnames]{xcolor}
\usepackage[3d]{luadraw}
\begin{document}
%https://tex.stackexchange.com/questions/755843/how-to-draw-cone-with-infinitely-many-extremal-rays
\begin{luadraw}{name=regular_pyramid_07_12_2025}
local g = graph3d:new{window={-10,10,-5,11},viewdir={30,70},size={12,12}}
g:Linejoin("round"); g:Linewidth(6); Hiddenlines = true; Hiddenlinestyle = "dashed"
local a, n, h = 3, 20, 10
local O = Origin
local P = regular_pyramid(n,a,h,O)
g:Dpoly(regular_pyramid(n,a,h,O), {mode=4,color="Crimson"})
g:Show()
\end{luadraw}
\end{document}

you can use the function cvx_hull3d(L) to make a section.
\documentclass[12pt]{standalone}
\usepackage[svgnames]{xcolor}
\usepackage[3d]{luadraw}
\begin{document}
\begin{luadraw}{name=section_cone}
local g = graph3d:new{window={-10,10,-5,21},viewdir={50,70},size={12,12}}
Hiddenlines = true; Hiddenlinestyle = "dashed"
local a, n, h = 5, 10, 18
local O = Origin
local P = regular_pyramid(n,a,h,O)
local A,B,C,D,E,F,G,H,K,L,S = table.unpack(P.vertices)
local L = {A,B,C,D,E,F,G,H,S}
g:Dscene3d(
g:addFacet(cvx_hull3d(L), {color="Orange",edge=true})
)
g:Show()
\end{luadraw}
\end{document}
