As per MS , we have to setup a Office 365 tenant before we can develop a SPFx webparts.
Is it mandatory to have the Office 365 tenant or can proceed without having to create a Microsoft 365 tenant.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
I guess technically you could develop webparts without a tenancy, but you wouldn't have a way of testing/using them.
However, you could look into applying to join the Office Developer Program, where you can get a free tenancy. The developer license only lasts for 90 days, but if you're doing active development (according to magical Microsoft telemetry), the license is automatically renewed for another 90 days.
You could develop/test SPFx solution in your SharePoint 2019 environment directly, just follow official document to configure your dev environment first, then you could create SPFx solution targets to 2019.
You could also register your developer subscription which is free. https://docs.microsoft.com/en-us/office/developer-program/microsoft-365-developer-program