There are many articles online about making your own baby gate out of mesh, fabric, wood, and PVC. Being a parent is expensive, so I understand why people want to find cheaper alternatives.
While this may be appealing, especially if you have an irregular stair opening, there is a reason why you can only purchase baby fences and gates that have been independently assessed and passed stringent safety standards.
Homemade gates and fences may pose safety risks to your child by lacking features such as two-step opening (source). From openings between slats that are too wide to materials that could injure your child, there are many potential failures for a homemade baby fence.