Wanting to "try before you buy" is a very good idea.
You may find that a compact pistol is very hard to shoot quickly, accurately, and well, and therefore may be a bad choice for self-defense.
I do not believe that one handgun would successfully fill all of your requirements. You will need to make several compromises.
• Although a full-size handgun will be somewhat difficult to conceal, if you are willing to compromise your pants and belt size, it can be done quite well.
• The most effective choice for home defense is probably a shotgun, but if you are willing to practice pistolcraft a lot, a full-size pistol will do quite well enough for this purpose.
• If you are indeed willing to practice your pistolcraft, to build and then maintain your skills, the "lots of bullets" issue isn't important. Accuracy trumps magazine capacity every time.
• If you also practice awareness and observation, and then avoidance, you may never be involved in a gunfight at all. That's a good thing.
• There is no need to choose among .38 Special, 9mm, .40, and .45: any one of them will do. Accuracy and bullet placement trumps ballistics every time.
• All guns are fun to shoot, if you set yourself reasonable, meaningful shooting tasks and useful goals. Every improvement and achievement increases your satisfaction and your fun.
Yes, by all means take a class. Take several classes. Never stop learning.